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

Start autocomplete generation for fish #775

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mrmeszaros
Copy link
Contributor

Added complete command that generates basic auto-completions for fish.
Other shells are not supported yet.

Fixes #753

Added `complete` command that generates basic auto-completions for fish.
Other shells are not supported yet.

Fixes direnv#753
@zimbatm
Copy link
Member

zimbatm commented Mar 8, 2021

I think I would rather convert direnv to use urfave/cli or another CLI library that already supports completion out of the box. At the time where direnv was written, those didn't exist.

@zimbatm
Copy link
Member

zimbatm commented Mar 8, 2021

Alternatively, ship the completion script as part of the install. Or does it require to interact with the binary?

@mrmeszaros
Copy link
Contributor Author

@zimbatm Great idea, I love CLI libraries (I use click for python <3).
They make it easy to keep help / man page uniform and consistent with the app.

I am rather new to Go, but I will look into it.
Here they recommend Cobra for CLI building (and Viper for config management).
I will check out urfave/cli and try to compare them.

Cobra seems to support generating completion for bash, zsh, fish and PowerShell. No elvish yet, but its pre-1.0 so it may change in the future. No tcsh either, but I am unfamiliar with that shell's popularity.

As for a static autocomplete script.
I thought that having the help text in two different locations - the command file and the completion script - would make it easier to de-synchronize. I saw a few projects use that kind of thinking. Might be overthinking though (eg. git has them separate) - the interface should not change that often to matter.

@mrmeszaros
Copy link
Contributor Author

Ok, so another search resulted in a "curated" list of CLI libraries - so even more choices to make I guess.

Now, do You have any measures / priorities to optimize for? Like future support plausibility / performance / readability?

@zimbatm
Copy link
Member

zimbatm commented Mar 16, 2021

I had a look at the list and https://github.com/mkideal/cli looks pretty good. There is so much choice, I am sure other options would probably be fine as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

How about including fish completion
2 participants