Open budimanjojo opened 2 years ago
@suzuki-shunsuke any plans on implementing this?
Brew does this by default:
zsh completions and functions have been installed to:
/usr/local/share/zsh/site-functions
Hmm. I have no plan about this, but this issue has five 👍 at the moment. I'll consider when I have time.
The problem is when there are multiple versions of the same program, but completions are rarely being updated and it doesn't really do anything harmful to the system. So maybe just override whatever version aqua install the last time.
I disagree. Wrong completions are worse than no completions.
That said, for globally installed tools, this approach would be good enough.
One thing to consider is that many modern tools don't ship with completions in files, but generate them. I understand that aqua very explicitly does not run any downloaded code. Also, the specific command differs across tools (completion
, completions
, shell-completion
, generation-completion
, ...), never mind some shells not being supported by some tools. So how would aqua go about creating the completion files in any general way?
What I could imagine is that package descriptions could include the completion command for each tool, if any, and aqua could print a list of those, maybe like so:
> aqua cp-completions [-t stuff]
cog generate-completions
delta --generate-completion
yq completion
Coming up with a shell script that loops over that list, inserts the shell name, and evaluates/writes the outputs appropriately would then be relatively easy. (If not without risk, from the perspektive of the user -- but entirely opt-in.)
Feature Overview
It would be great if aqua can handle shell completions. A lot of packages provide completions that will be installed when using package manager. For example: https://github.com/go-task/task/tree/master/completion. Maybe
aqua
can create a directory in$AQUA_ROOT/completion/{bash|fish|ps|zsh}
and copy those files there too? Users can just add the completion path to their shell, for example fish users can add$AQUA_ROOT/completion/fish
to their$fish_complete_path
, zsh users can add$AQUA_ROOT/completion/zsh
to their$fpath
, bash users can source the path (maybe, I'm not really sure how bash completion works for custom path though).Why is the feature needed?
It's nice to have, but not really needed.
Does the feature include Breaking Changes?
No,
Example Code
I'm thinking in
aqua-registry.yaml
, add something like this:The problem is when there are multiple versions of the same program, but completions are rarely being updated and it doesn't really do anything harmful to the system. So maybe just override whatever version aqua install the last time.