Skip to content

Commit

Permalink
Return exit code 2 when option isn't recognized. (#304)
Browse files Browse the repository at this point in the history
Follow standard practice, so that client code can detect if there is an issue.
We already returned error code 2 in other cases of option parsing failure,
now everything is covered in a consistent manner.
  • Loading branch information
slaykachu authored Jun 18, 2021
1 parent 700ce88 commit 64d3a60
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/erlfmt.erl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ main(Argv) ->
erlfmt_cli:do("erlfmt", [{files, ExtraFiles} | ArgOpts]);
{error, Error} ->
io:put_chars(standard_error, [getopt:format_error(Opts, Error), "\n\n"]),
getopt:usage(Opts, "erlfmt")
getopt:usage(Opts, "erlfmt"),
erlang:halt(2)
end.

%% rebar3 plugin entry point
Expand Down

0 comments on commit 64d3a60

Please sign in to comment.