davetron5000 / gli

Make awesome command-line applications the easy way
http://davetron5000.github.io/gli
Apache License 2.0
1.26k stars 102 forks source link

How can I show sub command help? #282

Closed ripperhe closed 3 years ago

ripperhe commented 5 years ago
    desc 'Describe test here'
    arg_name 'Describe arguments to test here'
    command :test do |c|
      c.action do |global_options,options,args|
        puts "test command ran"
      end

      c.desc 'Test sub command t1'
      c.command :t1 do |t1|
        t1.action do |global_options,options,args|
          puts "t1 ran"
        end
      end

      c.desc 'Test sub command t2'
      c.command :t2 do |t2|
        t2.action do |global_options,options,args|
          puts "t2 ran"
        end
      end
    end

How can I show help for Test?

davetron5000 commented 5 years ago
> my_app help test # should show help for the test commands
> my_app help test t2 # should show help for the t2 command
ripperhe commented 5 years ago

Ok, I get it. Thank you!

binford2k commented 4 years ago

So my_app help test --help displays the help for the test command.

Why doesn't my_app help test t2 --help show help for test t2?

davetron5000 commented 4 years ago

The intention was that my_app help test t2 would be sufficient. --help in that second context would be interpreted as a command line flag for the t2 subcommand which, if not implemented, may result in an error.