Skip to content

Can a verb have a child verb? #35

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

Closed
ericnewton76 opened this issue Nov 4, 2017 · 7 comments
Closed

Can a verb have a child verb? #35

ericnewton76 opened this issue Nov 4, 2017 · 7 comments

Comments

@ericnewton76
Copy link
Member

Issue by sgrassie
Friday Jul 17, 2015 at 10:56 GMT
Originally opened as gsscoder/commandline#201


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+?

@ericnewton76
Copy link
Member Author

Comment by gsscoder
Saturday Jul 18, 2015 at 03:57 GMT


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.

@ericnewton76
Copy link
Member Author

Comment by pthivierge
Thursday Dec 03, 2015 at 18:52 GMT


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

@ericnewton76
Copy link
Member Author

Comment by nemec
Sunday Dec 06, 2015 at 01:24 GMT


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.

@ericnewton76
Copy link
Member Author

Comment by pthivierge
Monday Dec 07, 2015 at 09:18 GMT


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

@ericnewton76
Copy link
Member Author

Comment by Mizipzor
Friday Jan 29, 2016 at 22:21 GMT


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

@johnjaylward
Copy link
Contributor

Isn't this the same as #13? maybe close as a duplicate?

This was referenced May 26, 2020
@moh-hassan
Copy link
Collaborator

Dupl #13

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