Skip to content
Browse files

agner versions is now aware of the fact that package might be not found

  • Loading branch information...
1 parent b8b3e05 commit f69dcb7d46d376c33720b9ddec06a6d9becc6878 @yrashk yrashk committed
Showing with 14 additions and 8 deletions.
  1. BIN rebar
  2. +14 −8 src/agner_main.erl
View
BIN rebar
Binary file not shown.
View
22 src/agner_main.erl
@@ -253,14 +253,20 @@ handle_command(versions, Opts) ->
Package ->
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)))])
+ case agner:versions(Package) of
+ {error, not_found} ->
+ format_error({not_found, "Package not found"}),
+ {error, 1};
+ Versions ->
+ 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,
+ Versions))])
+ end
end;
handle_command(search, Opts) ->

0 comments on commit f69dcb7

Please sign in to comment.
Something went wrong with that request. Please try again.