Skip to content

Commit

Permalink
handle args passed as binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
madlep authored and Ledest committed Oct 17, 2024
1 parent 8a46724 commit 382f4a3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/otpbp_argparse.erl
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,9 @@ parse(Args, Command, Options) ->
Prog = validate(Command, Options),
%% use maps and not sets v2, because sets:is_element/2 cannot be used in guards (unlike is_map_key)
Prefixes = maps:from_list([{P, true} || P <- maps:get(prefixes, Options, [$-])]),
Args2 = [unicode:characters_to_list(Arg) || Arg <- Args],
try
parse_impl(Args, merge_arguments(Prog, Command, init_parser(Prefixes, Command, Options)))
parse_impl(Args2, merge_arguments(Prog, Command, init_parser(Prefixes, Command, Options)))
catch
%% Parser error may happen at any depth, and bubbling the error is really
%% cumbersome. Use exceptions and catch it before returning from `parse/2,3' instead.
Expand Down

0 comments on commit 382f4a3

Please sign in to comment.