Skip to content

Commit e649b2a

Browse files
committed
WIP
1 parent e6429db commit e649b2a

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

deps/rabbit/src/rabbit_cli_main.erl

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,20 @@
22

33
-include("src/sysexits.hrl").
44

5-
-export([run/2]).
5+
-export([run/2,
6+
run_old/2]).
67

78
-spec run(string(), iodata()) -> ok.
89

9-
run(ProgName, RawArgs) ->
10+
run(_ProgName, Args) ->
11+
ParserOpts = #{},
12+
CommandMods = discover_commands(),
13+
CommandSpec = collect_args_spec(CommandMods, ParserOpts),
14+
rabbit_cli_io:setup(#{}), % ParsedArgs
15+
argparse:run(Args, CommandSpec, ParserOpts),
16+
rabbit_cli_io:close().
17+
18+
run_old(ProgName, RawArgs) ->
1019
ParserOpts = #{progname => ProgName},
1120
CommandMods = discover_commands(),
1221
CommandSpec = collect_args_spec(CommandMods, ParserOpts),
@@ -86,15 +95,15 @@ set_log_level({ArgMap, _}) ->
8695
collect_args_spec(Modules, Options) when is_list(Modules) ->
8796
lists:foldl(
8897
fun (Mod, Cmds) ->
89-
ModCmd =
90-
try
91-
{_, MCmd} = argparse:validate(Mod:cli(), Options),
92-
MCmd
93-
catch
94-
_:_ ->
95-
%% TODO: Handle error.
96-
#{}
97-
end,
98+
ModCmd = Mod:cli(),
99+
%try
100+
%{_, MCmd} = argparse:validate(Mod:cli(), Options),
101+
%MCmd
102+
%catch
103+
%_:_ ->
104+
%%% TODO: Handle error.
105+
%#{}
106+
%end,
98107

99108
%% handlers: use first non-empty handler
100109
Cmds1 =

0 commit comments

Comments
 (0)