summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2015-06-25 21:17:05 -0500
committerTristan Sloughter <t@crashfast.com>2015-06-25 21:17:27 -0500
commitc2209785f96b8de2fd3a77017a038711be2d6cc0 (patch)
tree80aa39dda1e0e8537609792125b521cda6392bd0
parent136540ff106d667866cf70d17df1c7b6cdf13bb9 (diff)
add error message when no plugin is passed to plugins upgrade
-rw-r--r--src/rebar_prv_plugins_upgrade.erl10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/rebar_prv_plugins_upgrade.erl b/src/rebar_prv_plugins_upgrade.erl
index fbd8365..c80dffc 100644
--- a/src/rebar_prv_plugins_upgrade.erl
+++ b/src/rebar_prv_plugins_upgrade.erl
@@ -33,10 +33,16 @@ init(State) ->
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
do(State) ->
{Args, _} = rebar_state:command_parsed_args(State),
- Plugin = proplists:get_value(plugin, Args, <<"">>),
- upgrade(Plugin, State).
+ case proplists:get_value(plugin, Args, none) of
+ none ->
+ ?PRV_ERROR(no_plugin_arg);
+ Plugin ->
+ upgrade(Plugin, State)
+ end.
-spec format_error(any()) -> iolist().
+format_error(no_plugin_arg) ->
+ io_lib:format("Must give an installed plugin to upgrade as an argument", []);
format_error({not_found, Plugin}) ->
io_lib:format("Plugin to upgrade not found: ~s", [Plugin]);
format_error(Reason) ->