Skip to content

Commit

Permalink
Merge pull request #1 from milmazz/escript
Browse files Browse the repository at this point in the history
Add an alias for --help
  • Loading branch information
GeoffreyPS committed Oct 6, 2016
2 parents ee402c3 + b6f8871 commit eaf3dd0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
Binary file modified demo_application_escript/demo_application
Binary file not shown.
9 changes: 3 additions & 6 deletions demo_application_escript/lib/demo_CLI.ex
Expand Up @@ -2,20 +2,18 @@ defmodule DemoApplication.CLI do
alias DemoApplication.DemoModule

def main(args) do
args |> parse_args |> do_process
args |> parse_args() |> do_process()
end

def parse_args(args) do
options = OptionParser.parse(args)
options = OptionParser.parse(args, aliases: [h: :help])

case options do
{[help: true], _, _} -> :help
{[h: true], _, _} -> :help
_ -> :run
end
end


def do_process(:run) do
DemoModule.say_it(:demo_module)
end
Expand All @@ -26,5 +24,4 @@ defmodule DemoApplication.CLI do
"""
end

end
end
2 changes: 1 addition & 1 deletion demo_application_escript/mix.exs
Expand Up @@ -8,7 +8,7 @@ defmodule DemoApplication.Mixfile do
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps(),
escript: escript]
escript: escript()]
end

# Configuration for the OTP application
Expand Down

0 comments on commit eaf3dd0

Please sign in to comment.