-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace case with with #245
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,18 +4,15 @@ defmodule Onigumo.CLI do | |
} | ||
|
||
def main(argv) do | ||
case OptionParser.parse( | ||
argv, | ||
aliases: [C: :working_dir], | ||
strict: [working_dir: :string] | ||
) do | ||
{parsed_switches, [component], []} -> | ||
{:ok, module} = Map.fetch(@components, String.to_atom(component)) | ||
working_dir = Keyword.get(parsed_switches, :working_dir, File.cwd!()) | ||
module.main(working_dir) | ||
parse_result = | ||
OptionParser.parse(argv, aliases: [C: :working_dir], strict: [working_dir: :string]) | ||
|
||
_ -> | ||
usage_message() | ||
with {parsed_switches, [component], []} <- parse_result do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There you can see that you call parsed_switches as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I don’t really like the |
||
{:ok, module} = Map.fetch(@components, String.to_atom(component)) | ||
working_dir = Keyword.get(parsed_switches, :working_dir, File.cwd!()) | ||
module.main(working_dir) | ||
else | ||
_ -> usage_message() | ||
end | ||
end | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parse
should be enough, but at leastparsed_result
with d is more semantically right in my opinion.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔
parsed_result
doesn’t seem right to me: it’s not a result that has been parsed; it’s a result of parsing.parse_result
tried to convey the message that it’s a result of theparse
function.Shortened to a single word,
parsed
may be a better choice.parse
sounds like an action rather than a value.