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

feature request: add completions for interface names #302

Open
wwalker opened this issue Feb 23, 2024 · 6 comments
Open

feature request: add completions for interface names #302

wwalker opened this issue Feb 23, 2024 · 6 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@wwalker
Copy link
Contributor

wwalker commented Feb 23, 2024

When one gets here, it would be nice to include the known innernet interfaces to the results of the completion:

$ innernet show
-s           -h           --tree       [INTERFACE]
-t           --short      --help

I.e.:

$ innernet show
-s           -h           --tree       [INTERFACE]     ice-station-alpha
-t           --short      --help       shennanigans 
@strohel strohel added enhancement New feature or request good first issue Good for newcomers labels Feb 24, 2024
@artogahr
Copy link

I'd like to give this a shot

@wwalker
Copy link
Contributor Author

wwalker commented Feb 25, 2024

Here is my first pass at it in patch format.

patch-p0.gz

@artogahr
Copy link

Thanks @wwalker , the sample you provided definitely helps me understand how completions work. I believe it's only doing completions for bash, yes?

While doing some research on this I've came across clap_complete, which this repo appears to be using. If I understand the situation correctly, if I implement this behavior with clap_complete, clap should generate all the relevant shell files without us manually having to do work for each one.

That said, I'm not sure how I will actually implement this yet :)

@artogahr
Copy link

It seems clap_complete doesn't support dynamic completions yet, huh. It's being tracked here:

clap-rs/clap#1232

Does it make sense (from a code cleanliness point) to add these completions manually? Or should we wait for clap_complete to implement this feature?

@wwalker
Copy link
Contributor Author

wwalker commented Mar 26, 2024

Since it has been 6 years since clap-rs/clap#1232 was opened, with no actual attempt to implement it (just opening other tickets), I would argue against waiting on them.

@wwalker
Copy link
Contributor Author

wwalker commented Mar 26, 2024

Possibly open a new github repo where you run innernet completions bash, and then patch it to have peer and network dynamic completions? People can come there to get a "fuller" completion if they want, but the basic completions stay built into innernet via clap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants