-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Support automatic subcommands for completion #810
Comments
This would be an easy addition, although it'd probably get implemented as an The one thing that gives me pause, is that I've seen this done in a few different ways by different applications, such as Is the |
I don't know if one is more popular/"standard" than another. I thought I had other examples up my sleeve, but the only one I can think of now is |
In all honesty it'd be possible to give options for both, which is how I think I'll tackle this.
|
Is this possible anymore? The clap_generate package depends on clap. Won't this be a circular package dependency? working in this branch: |
@rharriso Try the clap_generate now, it should work. But yeah, this would become a circular dependency. I am not sure we want this. Maybe we could do some kind of macro. |
@CreepySkeleton Would love your input here. |
That's possible. We can make Pros:
Cons: |
@CreepySkeleton You mean |
There must have been a reason Kevin wanted to make it a separate crate.
…On Tue, Mar 3, 2020, 16:47 Guillaume P. ***@***.***> wrote:
@CreepySkeleton <https://github.com/CreepySkeleton> You mean clap_generate
instead of clap_derive ?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#810?email_source=notifications&email_token=AABKU35NWB52OG4OZCVHKO3RFURBVA5CNFSM4C3WHVVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENUAHZY#issuecomment-594019303>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABKU3ZGNHAF4PG3EOK2DJ3RFURBVANCNFSM4C3WHVVA>
.
|
@TeXitoi right 😨 |
I don't see any reason, honestly. Not any I would call a good one. |
The advantage is that you will not compile it if you don't use it. The other solution is features, and I personally prefer to keep features to the bare minimum as they complexify the code considerably. But, having this implementation hole is quite dirty. I think the clean way would be:
The second way seems easier now. But that's just my humble opinion, I didn't even seen the code. |
I made as much of introspection API public. The remaning stuff are |
That's gonna be one module level I've seen the code, I've been trying to implement an introspection API of sorts (you just read my mind 😃, ha!), and I feel like I'm failing.
You did? Mind elaborate? |
I hate to be rude, but that's actually not true at all. Just grep for |
@TeXitoi They seem to be implementing explicit support for features in docs.rs, see dtolnay/syn#734 . We might as well do that too. Looks neat unless you have lots of cfg'ed items (we don't): https://docs.rs/tokio/0.2.13/tokio/index.html#modules |
@pksunkara @kbknapp So can we finally decide whether we want this or not? More specifically, are we open to inclusion |
I will take care of this. I have a few ideas on how to fix this. |
btw another way of solving this is instead of having a setting for this, to provide types that implement |
While not automatic, we are exposing this as For stabilization of this feature, see #3166 |
It seems to be something of a pattern for apps to support completion via the following:
It'd be nice if there were a helper on
App
so that we could call.add_completion_subcommands()
and have this wired up automatically.The text was updated successfully, but these errors were encountered: