eza-community / eza

A modern alternative to ls
https://eza.rocks
European Union Public License 1.2
11.93k stars 216 forks source link

feat: Add `--completions` option or a better interface to get shell completions #1187

Closed ShaiAvr closed 2 weeks ago

ShaiAvr commented 2 weeks ago

I use zsh and on my mac, I got tab completions for eza. I found that it's available through homebrew in $(brew --prefix)/share/zsh/site-functions. The installation guide also mentions the completions are available through homebrew. On my Ubuntu machine, I didn't get completions immediately so I went back to the installation guide which prompted me to clone the entire eza repository just to add the completions to my FPATH. It looks really odd to me that I need to clone the entire repo just to access the completions while on Mac with homebrew, it works pretty much out of the box. Most commands have a completions subcommand or option which prints the completions for the requested shell. For example, with starship, I can execute starship completions zsh > ~/.zfunc/_starship to generate a completions file.

I think a completions command or option should be added to eza to make it easier to generate completions. I find it very odd that the instructions tell me to clone the entire repo just for the completions. In addition, the installation guide only has instructions for zsh with or without homebrew, while the repo also has completion files for bash, fish and nushell. I think the instructions should at the very least be updated for all of those shells.

cafkafk commented 2 weeks ago

Ultimately, this is more of a homebrew issues than an eza issue, other package managers are able to handle completions much more elegantly, and when even cargo thinks this isn't a problem that build tools should solve, I think it's perfectly reasonable that we don't totally solve the actual installation for each possible package manager, but rather that the package manager itself, and the packages maintainer, solves this.

For that reason I'll mark this as a wont fix, the actual --completion command will likely be free when we move to clap, and I'm pretty sure we already have an issue for doing this. But the underlying problem here for homebrew is not one we will be able to fix, it may be worth to take it upstream to homebrew?