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

Is there a way to design sub-sub commands? #8

Closed
agibralter opened this issue Mar 20, 2017 · 3 comments
Closed

Is there a way to design sub-sub commands? #8

agibralter opened this issue Mar 20, 2017 · 3 comments

Comments

@agibralter
Copy link

E.g. if I'd like the following:

$ command sub-command --option1=foo sub-sub-command arg1 arg2
@mosop
Copy link
Owner

mosop commented Mar 22, 2017

Hi. You can make "sub-sub" commands by simply nesting Command classes.

class Foo < Cli::Supercommand
  class Bar < Cli::Supercommand
    class Baz < Cli::Command
      def run
        puts "bazz!"
      end
    end
  end
end

Unfortunately, there's no way to define supercommand's options like the sample code that you wrote. I like to add such a feature in the future version but probably it's not soon.

@mosop
Copy link
Owner

mosop commented Apr 7, 2019

#17

@mosop mosop closed this as completed Apr 7, 2019
@jjlorenzo
Copy link

In the meantime I'm intercepting the supercommand run and storing the options in a global property.
https://github.com/jjlorenzo/dfg/blob/master/src/dfg/dotfiles.cr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants