diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2014-12-21 11:02:20 -0500 |
---|---|---|
committer | Fred Hebert <mononcqc@ferd.ca> | 2014-12-21 11:02:20 -0500 |
commit | ae54d70e6ce64b97f2d60400b24d1219369617b5 (patch) | |
tree | bc980a5d3f17727c492d5624f19d7e77c57c6954 /src | |
parent | c25fbab1c60836ccbc20225b5a10eea2fb285d48 (diff) |
Add support for namespace-based metacommands
And more general namespace support
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_core.erl | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/rebar_core.erl b/src/rebar_core.erl index eaa546a..96ba426 100644 --- a/src/rebar_core.erl +++ b/src/rebar_core.erl @@ -37,8 +37,17 @@ process_command(State, Command) -> Providers = rebar_state:providers(State), TargetProviders = providers:get_target_providers(Command, Providers), case providers:get_provider(Command, Providers) of - not_found -> - {error, io_lib:format("Command ~p not found", [Command])}; + not_found when is_atom(Command) -> + Namespace = Command, + process_command(State, {Namespace, do}); + not_found when is_tuple(Command) -> + case Command of + {default,Cmd} -> + {error, io_lib:format("Command ~p not found", [Cmd])}; + {Namespace,Cmd} -> + {error, io_lib:format("Command ~p not found in namespace ~p", + [Cmd, Namespace])} + end; CommandProvider -> case Command of Command when Command =:= do @@ -62,7 +71,7 @@ process_command(State, Command) -> -spec do([{atom(), atom()}], rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. do([], State) -> {ok, State}; -do([{ProviderName, _} | Rest], State) -> +do([ProviderName | Rest], State) -> Provider = providers:get_provider(ProviderName ,rebar_state:providers(State)), case providers:do(Provider, State) of |