Skip to content

Commit

Permalink
Merge pull request #212 from nappex/matcherror-vanish
Browse files Browse the repository at this point in the history
Do not rescue MatchErrors in CLI
  • Loading branch information
nappex authored Feb 24, 2024
2 parents 48164da + 445b867 commit f3b0a4b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions lib/cli.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@ defmodule Onigumo.CLI do
}

def main(argv) do
try do
{[], [component], []} = OptionParser.parse(argv, strict: [])
component
rescue
MatchError -> usage_message()
else
component ->
case OptionParser.parse(argv, strict: []) do
{[], [component], []} ->
{:ok, module} = Map.fetch(@components, String.to_atom(component))
root_path = File.cwd!()
module.main(root_path)

_ ->
usage_message()
end
end

Expand Down

0 comments on commit f3b0a4b

Please sign in to comment.