Skip to content

Commit

Permalink
Added --no-releases and --no-flavours options for 'spec versions'
Browse files Browse the repository at this point in the history
  • Loading branch information
yrashk committed Feb 1, 2011
1 parent 1563446 commit 8b10007
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -148,9 +148,10 @@ property will make use of AGNER_PREFIX OS environment variable (which defaults t
Uninstall given package (and a particular VERSION of it, if specified). Will use local SPECFILE is `--spec-file`/`-s` Uninstall given package (and a particular VERSION of it, if specified). Will use local SPECFILE is `--spec-file`/`-s`
option is passed. option is passed.


agner versions PACKAGE agner versions PACKAGE [--no-flavours] [--no-releases]


List the versions of the given `PACKAGE` List the versions of the given `PACKAGE`. Specifying `--no-flavours` will omit flavour versions; and specifying
`--no-releases` will omit release versions respectively.


agner prefix PACKAGE [-v/--version VERSION] agner prefix PACKAGE [-v/--version VERSION]


Expand Down
14 changes: 11 additions & 3 deletions src/agner_main.erl
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ arg_proplist() ->
{versions, {versions,
"Show the available releases and flavours of a package", "Show the available releases and flavours of a package",
[ [
{package, undefined, undefined, string, "Package name"} {package, undefined, undefined, string, "Package name"},
{no_flavours, undefined, "no-flavours", {boolean, false}, "Don't show flavour versions"},
{no_releases, undefined, "no-releases", {boolean, false}, "Don't show release versions"}
]}}, ]}},
{"list", {"list",
{list, {list,
Expand Down Expand Up @@ -209,8 +211,14 @@ handle_command(versions, Opts) ->
undefined -> undefined ->
io:format("ERROR: Package name required.~n"); io:format("ERROR: Package name required.~n");
Package -> Package ->
io:format("~s",[lists:usort(plists:map(fun (Version) -> NoFlavours = proplists:get_value(no_flavours, Opts),
io_lib:format("~s~n",[agner_spec:version_to_list(Version)]) NoReleases = proplists:get_value(no_releases, Opts),
io:format("~s",[lists:usort(plists:map(fun ({flavour, _} = Version) when not NoFlavours ->
io_lib:format("~s~n",[agner_spec:version_to_list(Version)]);
({release, _} = Version) when not NoReleases ->
io_lib:format("~s~n",[agner_spec:version_to_list(Version)]);
(_) ->
""
end, end,
agner:versions(Package)))]) agner:versions(Package)))])
end; end;
Expand Down

0 comments on commit 8b10007

Please sign in to comment.