Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
at-grandpa committed Jul 7, 2018
1 parent 0f13527 commit 1966af6
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
@@ -0,0 +1,22 @@
require "./../../../../src/clim"

class MyCli < Clim
main_command do
run do |opts, args|
end
sub_command "sub_command" do
desc "sub_comand."
option "-n NUM", type: Int32, desc: "Number.", default: 0
run do |opts, args|
end
sub_command "sub_sub_command" do
desc "sub_sub_comand description."
option "-p PASSWORD", type: String, desc: "Password.", required: true
run do |opts, args|
end
end
end
end
end

MyCli.start(ARGV)
21 changes: 21 additions & 0 deletions spec/clim/compile_time_error_spec/stdout_spec.cr
Expand Up @@ -15,6 +15,27 @@ describe "STDOUT spec, " do
sub_sub_command sub_sub_comand description.
DISPLAY
end
it "display main_command help." do
`crystal run spec/clim/compile_time_error_spec/files/main_command_default_help.cr --no-color -- sub_command --help`.should eq <<-DISPLAY
sub_comand.
Usage:
sub_command [options] [arguments]
Options:
-n NUM Number. [type:Int32] [default:0]
--help Show this help.
Sub Commands:
sub_sub_command sub_sub_comand description.
DISPLAY
end
end

0 comments on commit 1966af6

Please sign in to comment.