Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added --no-releases and --no-flavours options for 'spec versions'

  • Loading branch information...
commit 8b10007655ae8a77a7f3a31be0f17e8a170dac60 1 parent 1563446
@yrashk yrashk authored
Showing with 14 additions and 5 deletions.
  1. +3 −2 README.md
  2. +11 −3 src/agner_main.erl
View
5 README.md
@@ -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`
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]
View
14 src/agner_main.erl
@@ -33,7 +33,9 @@ arg_proplist() ->
{versions,
"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,
@@ -209,8 +211,14 @@ handle_command(versions, Opts) ->
undefined ->
io:format("ERROR: Package name required.~n");
Package ->
- io:format("~s",[lists:usort(plists:map(fun (Version) ->
- io_lib:format("~s~n",[agner_spec:version_to_list(Version)])
+ NoFlavours = proplists:get_value(no_flavours, Opts),
+ 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,
agner:versions(Package)))])
end;
Please sign in to comment.
Something went wrong with that request. Please try again.