summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2015-06-19 21:14:38 -0500
committerTristan Sloughter <t@crashfast.com>2015-06-19 21:15:06 -0500
commit5a6b551eb51853c2297d74bac2c9e9c14a2d4409 (patch)
tree4f1d427d3b8532a9ef3de6ee247637024d2e5fe1
parent4bb2a0c71006784442f285bbfac7559e4be51f67 (diff)
print help for namespaces
-rw-r--r--src/rebar_prv_do.erl12
-rw-r--r--src/rebar_prv_help.erl8
2 files changed, 17 insertions, 3 deletions
diff --git a/src/rebar_prv_do.erl b/src/rebar_prv_do.erl
index 35e85c2..f850135 100644
--- a/src/rebar_prv_do.erl
+++ b/src/rebar_prv_do.erl
@@ -33,8 +33,16 @@ init(State) ->
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
do(State) ->
- Tasks = rebar_utils:args_to_tasks(rebar_state:command_args(State)),
- do_tasks(Tasks, State).
+ case rebar_utils:args_to_tasks(rebar_state:command_args(State)) of
+ [] ->
+ AllProviders = rebar_state:providers(State),
+ Namespace = rebar_state:namespace(State),
+ Providers = providers:get_providers_by_namespace(Namespace, AllProviders),
+ providers:help(Providers),
+ {ok, State};
+ Tasks ->
+ do_tasks(Tasks, State)
+ end.
do_tasks([], State) ->
{ok, State};
diff --git a/src/rebar_prv_help.erl b/src/rebar_prv_help.erl
index 4bc259a..c028264 100644
--- a/src/rebar_prv_help.erl
+++ b/src/rebar_prv_help.erl
@@ -65,7 +65,13 @@ task_help(Namespace, Name, State) ->
Providers = rebar_state:providers(State),
case providers:get_provider(Name, Providers, Namespace) of
not_found ->
- {error, io_lib:format("Unknown task ~p", [Name])};
+ case providers:get_providers_by_namespace(Name, Providers) of
+ [] ->
+ {error, io_lib:format("Unknown task ~p", [Name])};
+ NSProviders ->
+ providers:help(NSProviders),
+ {ok, State}
+ end;
Provider ->
providers:help(Provider),
{ok, State}