Skip to content

Fetch the used subcommands without using Args::command().get_matches() #5390

Answered by epage
shard77 asked this question in Q&A
Discussion options

You must be logged in to vote

However, I've encountered a snag: using Args::command().get_matches() seems to consume the Command instance,

We offer _mut variants that don't consume.

even if I clone Args::command() to use get_matches()

This is confusing. If you generate separate Commands or clone them, then it should be fine. What problem are you running into?

However, you could run into errors that exit immediately. You would likely want to use a try_ prefixed version.

Lastly, is this the right place to ask such things? I don't want to bother anyone, in case it's not, I'll ask for support somewhere else.
Thanks in advance.

This is an appropriate place. There are also a contingent of people who generally discuss …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@shard77
Comment options

Answer selected by shard77
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