Skip to content

Is there a way to support two layers of sub-commands? #26

Closed Answered by ko1nksm
geneliu asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

I have not tried this, but it should already be supported.

e.g.:
command sub-command1 sub-sub-command1

Supplemented it with options/arguments to make it look like follows:

command [global-options] sub-cmd1 [options-for-sub-cmd1] sub-sub-cmd1 [options-for-sub-sub-cmd1] [arguments] 

To parse it, we need to perform three parses.

First parse (for command):

command [global-options] <sub-cmd> {doesn't care about the rest}

Second parse (for sub-cmd1):

sub-cmd1 [options-for-sub-cmd1] <sub-sub-cmd> {doesn't care about the rest}

Third parse (for sub-sub-cmd1):

sub-sub-cmd1 [options-for-sub-sub-cmd1] [arguments]

In other words, the number of subcommands+1 parser definition is required. Def…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ko1nksm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #25 on May 12, 2021 16:23.