소스 검색

improved a bit commandline : allow several hxml arguments

Nicolas Cannasse 19 년 전
부모
커밋
a59ca35811
1개의 변경된 파일14개의 추가작업 그리고 7개의 파일을 삭제
  1. 14 7
      main.ml

+ 14 - 7
main.ml

@@ -118,6 +118,7 @@ try
 	let swf_version = ref 8 in
 	let swf_version = ref 8 in
 	let swf_header = ref None in
 	let swf_header = ref None in
 	let current = ref argv_start in
 	let current = ref argv_start in
+	let has_hxml = ref false in
 	let next = ref (fun() -> ()) in
 	let next = ref (fun() -> ()) in
 	let hres = Hashtbl.create 0 in
 	let hres = Hashtbl.create 0 in
 	Plugin.defines := base_defines;
 	Plugin.defines := base_defines;
@@ -229,10 +230,17 @@ try
 						_ -> [l]
 						_ -> [l]
 				else
 				else
 					[l]
 					[l]
-			) lines) in
-			init (Array.of_list (cl :: args)) 0;
-			raise Exit
-		| _ -> classes := make_path cl :: !classes
+			) lines) in			
+			let cur = !next in
+			let verb = !Plugin.verbose in
+			next := (fun() ->
+				cur();
+				if verb then print_endline ("Executing " ^ cl ^ " : " ^ String.concat " " (List.tl args));
+				init (Array.of_list (cl :: args)) 0
+			);
+			has_hxml := true;
+		| _ ->
+			classes := make_path cl :: !classes
 	in
 	in
 	Arg.parse_argv ~current argv args_spec args_callback usage;
 	Arg.parse_argv ~current argv args_spec args_callback usage;
 	(match !target with
 	(match !target with
@@ -252,7 +260,7 @@ try
 		Plugin.define "js";
 		Plugin.define "js";
 	);
 	);
 	if !classes = [([],"Std")] then begin
 	if !classes = [([],"Std")] then begin
-		Arg.usage args_spec usage
+		if not !has_hxml then Arg.usage args_spec usage
 	end else begin
 	end else begin
 		if !Plugin.verbose then print_endline ("Classpath : " ^ (String.concat ";" !Plugin.class_path));
 		if !Plugin.verbose then print_endline ("Classpath : " ^ (String.concat ";" !Plugin.class_path));
 		let ctx = Typer.context type_error warn in
 		let ctx = Typer.context type_error warn in
@@ -279,8 +287,7 @@ try
 	end;
 	end;
 	if !has_error then do_exit();
 	if !has_error then do_exit();
 	(!next)();
 	(!next)();
-with
-	| Exit -> ()
+with	
 	| Lexer.Error (m,p) -> report (Lexer.error_msg m) p
 	| Lexer.Error (m,p) -> report (Lexer.error_msg m) p
 	| Parser.Error (m,p) -> report (Parser.error_msg m) p
 	| Parser.Error (m,p) -> report (Parser.error_msg m) p
 	| Typer.Error (m,p) -> report (Typer.error_msg m) p
 	| Typer.Error (m,p) -> report (Typer.error_msg m) p