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

Add shell completion #342

Open
seanhamlin opened this issue Apr 11, 2024 · 7 comments
Open

Add shell completion #342

seanhamlin opened this issue Apr 11, 2024 · 7 comments
Labels
enhancement New feature or request

Comments

@seanhamlin
Copy link
Collaborator

Is your feature request related to a problem? Please describe.

I would love shell completion for all Lagoon CLI commands and arguments.

Describe the solution you'd like

I believe Cobra has basic support for this

lagoon completion zsh > /tmp/lagoon.sh && source /tmp/lagoon.sh

However, this does not list the arguments from what I can tell.

It would also be nice to have documentation about this, perhaps around the installation instructions.

@seanhamlin seanhamlin added the enhancement New feature or request label Apr 11, 2024
@shreddedbacon
Copy link
Member

Huh, completion must have snuck in when I upgraded cobra a while back. Will need time to investigate, there may be limitation to what cobra provides, or how we do things that prevent it from working as intended.

@shreddedbacon
Copy link
Member

It seems to do arguments for me with bash? perhaps a zsh thing?

@tnelson-doghouse
Copy link

If I type:

$ lagoon ad

...and then press tab, I get

-bash: _get_comp_words_by_ref: command not found

HTH,

@shreddedbacon
Copy link
Member

I can't reproduce that behaviour, it works fine for me, so not sure where to even start here. Did your completion script get truncated, or are you sourcing it properly?

The shell completion scripts are not controlled by the lagoon-cli, but by cobra the underlying command library we use. So if there is a bug there, then I can't really help much.

@smlx
Copy link
Member

smlx commented May 14, 2024

@tnelson-doghouse Shell completion in bash relies on functions defined in the bash-completion library. I guess either you don't have bash-completion installed (that's what the package is called on Debian, not sure for other OS), or your .bashrc is missing this snippet.

@tnelson-doghouse
Copy link

Thanks @smlx ! Works for me now.

For the record, on Fedora I did:

sudo dnf install bash-completion

So it seems the remaining issues here are:

  • @seanhamlin can you confirm that you have the equivalent of bash completion installed and it still doesn't work?
  • Does the doco still need work here?

HTH,

@mxr576
Copy link

mxr576 commented Sep 20, 2024

+1 for better support (on ZSH)

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

No branches or pull requests

5 participants