Skip to content
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

Implement switch -h, --help to CLI #238

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
8 changes: 6 additions & 2 deletions lib/cli.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ defmodule Onigumo.CLI do
def main(argv) do
case OptionParser.parse(
argv,
aliases: [C: :working_dir],
strict: [working_dir: :string]
aliases: [h: :help, C: :working_dir],
strict: [help: :boolean, working_dir: :string]
) do
{[help: true], [], []} ->
usage_message()

{parsed_switches, [component], []} ->
{:ok, module} = Map.fetch(@components, String.to_atom(component))
working_dir = Keyword.get(parsed_switches, :working_dir, File.cwd!())
Expand All @@ -30,6 +33,7 @@ defmodule Onigumo.CLI do
COMPONENT\tOnigumo component to run, available: #{components}

OPTIONS:
-h, --help\t\tusage help
nappex marked this conversation as resolved.
Show resolved Hide resolved
-C, --working-dir <dir>\tChange working dir to <dir> before running
""")
end
Expand Down
Loading