diff options
author | Tristan Sloughter <[email protected]> | 2013-09-18 22:32:42 -0500 |
---|---|---|
committer | Tristan Sloughter <[email protected]> | 2013-09-19 20:26:25 -0500 |
commit | 6df9d493655775677400ca0348de747d90305256 (patch) | |
tree | f01a4e30515c87cd7e6a8e38c010b83806cda105 /src | |
parent | 0b59a913ef3b05a4a72622575a615a5a002cc86a (diff) | |
download | relx-6df9d493655775677400ca0348de747d90305256.tar.gz relx-6df9d493655775677400ca0348de747d90305256.tar.bz2 relx-6df9d493655775677400ca0348de747d90305256.zip |
add -v/--version cli option
Diffstat (limited to 'src')
-rw-r--r-- | src/relx.erl | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/relx.erl b/src/relx.erl index bc311f5..2aac8e4 100644 --- a/src/relx.erl +++ b/src/relx.erl @@ -47,11 +47,18 @@ main(Args) -> OptSpecList = opt_spec_list(), Result = case getopt:parse(OptSpecList, Args) of {ok, {Options, NonOptions}} -> - case lists:member(help, Options) of + case lists:member(version, Options) of true -> - usage(); + application:load(relx), + {ok, Vsn} = application:get_key(relx, vsn), + io:format("~s~n", [Vsn]); false -> - do([{caller, command_line} | Options], NonOptions) + case lists:member(help, Options) of + true -> + usage(); + false -> + do([{caller, command_line} | Options], NonOptions) + end end; {error, Detail} -> ?RLX_ERROR({opt_parse, Detail}) @@ -193,6 +200,7 @@ opt_spec_list() -> {override_app, $a, "override_app", string, "Provide an app name and a directory to override in the form <appname>:<app directory>"}, {config, $c, "config", {string, ""}, "The path to a config file"}, + {version, $v, "version", undefined, "Print relx version"}, {root_dir, $r, "root", string, "The project root directory"}]. -spec format_error(Reason::term()) -> string(). |