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

Can a verb have a child verb? #201

Open
sgrassie opened this issue Jul 17, 2015 · 5 comments
Open

Can a verb have a child verb? #201

sgrassie opened this issue Jul 17, 2015 · 5 comments

Comments

@sgrassie
Copy link
Contributor

I'd like to allow the following scenarios:

$ app verb -t
$ app verb childverb -u
$ app verb otherchildverb -z

Where -u and -z are both specific to the respective child verbs. Is the documentation in the wiki for this still valid, or has it changed in 2.0+?

@gsscoder
Copy link
Owner

Hi @sgrassie, thank you again for being there.

Starting from easy things... 2.0+ documentation is condensed in this part of the wiki.

Command Line never supported nested verb (nor previous stable), but it's a very interesting.

We can introduce a property to set the parent verb:

[Verb("verb1")]
class VerbOptions1 { }

[Verb("verbchild1", Parent="verb1")]
class VerbChildOptions1 { }

Than all options classes will be normally passed to ParseArguments<T1 ... Tn> with properly modified InstanceChooser.Choose call.

@pthivierge
Copy link

I am also looking for something like this, this may be useful. +1.

@nemec
Copy link
Collaborator

nemec commented Dec 6, 2015

Given the way verbs are defined now, out of band, this may be difficult to implement.

It may be possible to recursively call choose with the remaining arguments (after excluding the first matched verb) and incorporate @gsscoder's suggestion of a parent parameter.

@pthivierge
Copy link

Ok thanks, I understand. As of now, my alternative is to create more verb commands, instead of nested ones.

@alexanderfast
Copy link
Collaborator

Crazy idea, what if the verb name contained a space? Would that be able to fake a hierarchy?

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

5 participants