Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:18
efene
efene-usage.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File efene-usage.patch of Package efene
diff -Ndur efene/src/efene.erl efene-usage/src/efene.erl --- efene/src/efene.erl 2016-01-10 00:54:39.000000000 +0200 +++ efene-usage/src/efene.erl 2016-01-16 23:46:02.693927695 +0200 @@ -160,20 +160,16 @@ % command line interface main() -> - main([]). + usage(standard_error), + halt(1). -main([]) -> - io:format("Usage:~n"), - io:format("\tefene rawlex <file>: print raw lex tokens~n"), - io:format("\tefene lex <file>: print lex tokens after normalization~n"), - io:format("\tefene ast <file>: print efene abstract syntax tree~n"), - io:format("\tefene erlast <file>: print erlang abstract syntax tree (absform)~n"), - io:format("\tefene mod <file>: print erlang absform with module attributes~n"), - io:format("\tefene erl <file>: print erlang code for <file>~n"), - io:format("\tefene erl2ast <file.erl>: print erlang absform <file.erl>~n"), - io:format("\tefene beam <file> [<outdir>]: compile <file> to beam bytecode to <outdir>~n"), - io:format("\tefene pprint <file>: pretty print code from <file> (experimental)~n"), - ok; +main(["shell"]) -> + shell(); +main(["help"]) -> + usage(standard_io), + halt(0); +main(["usage"]) -> + main(["help"]); main(["rawlex", File]) -> print(to_raw_lex(File)); main(["lex", File]) -> @@ -190,8 +186,6 @@ print(from_erl(File)); main(["beam", File]) -> main(["beam", File, "."]); -main(["shell"]) -> - user_drv:start(["tty_sl -c -e", {fn_repl, start, []}]); main(["beam", File, OutputDir]) -> case compile(File, OutputDir, [debug_info]) of {ok, CompileInfo} -> @@ -207,11 +201,26 @@ main(["pprint", File]) -> pprint(File); main(Opts) -> - io:format("Invalid arguments: \"~p\"~n", [Opts]), - main([]). + io:format(standard_error, "Invalid arguments: '~p'~n", [Opts]), + main(). % private +usage(IO) -> + io:put_chars(IO, + "Usage:\n" + "\tefene rawlex <file>: print raw lex tokens\n" + "\tefene lex <file>: print lex tokens after normalization\n" + "\tefene ast <file>: print efene abstract syntax tree\n" + "\tefene erlast <file>: print erlang abstract syntax tree (absform)\n" + "\tefene mod <file>: print erlang absform with module attributes\n" + "\tefene erl <file>: print erlang code for <file>\n" + "\tefene erl2ast <file.erl>: print erlang absform <file.erl>\n" + "\tefene beam <file> [<outdir>]: compile <file> to beam bytecode to <outdir>\n" + "\tefene pprint <file>: pretty print code from <file> (experimental)\n\n"). + +shell() -> user_drv:start(["tty_sl -c -e", {fn_repl, start, []}]). + clean_tokens(Tokens) -> clean_tokens(Tokens, []). clean_tokens([], Accum) -> lists:reverse(Accum);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor