Skip to content

Add all the commands to the bash completion file (LP: #1749869) #326

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

Merged
merged 2 commits into from
Feb 23, 2023

Conversation

Image for: Conversation
Copy link
Contributor

daniloegea commented Feb 20, 2023

The file was (lazily) regenerated using the completely tool [0].

In the future we could do that in netplan itself using what we add to the argparse instance.

[0] - https://github.com/DannyBen/completely

Description

Image for: Description

In the future we could try to add a builtin command similar to what kubectl completion does and generate the script using argparse as source of information. Something like netplan completion [bash|zsh].

Checklist

Image for: Checklist
  • Runs make check successfully.
  • Retains 100% code coverage (make check-coverage).
  • New/changed keys in YAML format are documented.
  • (Optional) Adds example YAML for new feature.
  • (Optional) Closes an open bug in Launchpad. LP#1749869
The file was regenerated using the completely tool [0].

In the future we could do that in netplan itself using
what we add to the argparse instance.

[0] - https://github.com/DannyBen/completely
slyon changed the title Add all the commands to the bash completion file Feb 21, 2023
Copy link
Collaborator

slyon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank LGTM. Using completely sounds like a sensible choice and should make it much easier to keep this updated in the future!

I wonder if we could add some more dynamic bits to it, like suggesting network interfaces names on netplan status ... (see my inline comment).

In the future, we could also try to suggest querying the config via netplan get/set [network.[ethernets.[NETDEF_ID.[VALUE]]]] dynamically. But I think this is out of scope for now, as getting the config requires root permissions for now, which we cannot use inside the bash completions.

Enable the autocomplete to suggest network interfaces to netplan status.
Regenerate the netplan.completions file.

Co-authored-by: Lukas Märdian <slyon@ubuntu.com>
slyon merged commit 1d86585 into canonical:main Feb 23, 2023
daniloegea added a commit that referenced this pull request May 17, 2023
* Add all the commands to the bash completion file

The file was regenerated using the completely tool [0].

In the future we could do that in netplan itself using
what we add to the argparse instance.

[0] - https://github.com/DannyBen/completely

* Update tools/completely.yaml

Enable the autocomplete to suggest network interfaces to netplan status.
Regenerate the netplan.completions file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants