-
Notifications
You must be signed in to change notification settings - Fork 159
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
Use shell functions instead of aliases to avoid interfering with shell completion #433
Comments
Thank you so much for sharing the workaround! |
Note for myself: we'll also need to make this change in |
I started playing around with this idea and ran into a small snag -- it's easy to do in the Nix Flake way of configuring things, because we can just generate separate versions of the shell code. However, for users not using Nix and having the CLI manage their Bash/Zsh: my-func() {
echo "stuff"
} Fish: function my-func
echo "stuff
end I'm not sure the best way to approach this with the CLI. |
Simplest approach I guess would to also write out a Another approach could be to have a |
In the meantime, I've made my own hacky but automated solution in my dotfiles: https://github.com/jimeh/dotfiles/blob/f30c675f3b5cebd6a0b58be3905425e50d1b4ba3/zsh/1password.zsh Why? Because automating stuff is what we do right? Even if said automation might be horrible 😱... Hence, I don't suggest anyone uses my hacky solution, but if you fully understand how it works, and you're still ok with it, feel free to steal it... lol It basically loads the |
op CLI version
2.24.0
Goal or desired behavior
I want to setup the homebrew shell plugin (as an example), and have shell completion work correctly for
brew
, and also my custom shell alias (alias br=brew
).This can be achieved by using a shell function in
~/.config/op/plugins.sh
instead of an alias:Current behavior
Currently when you run
op plugin init brew
, a shell alias is written to~/.config/op/plugins.sh
, for example:This results in the
brew
command no longer having shell completions available on it, unlesssetopt completealiases
is used. But that breaks completion for shorthand aliases likealias br=brew
, because it will try to find completions for a command namedbr
.Hence the shell function approach is the only one that works correctly in both scenarios.
Relevant log output
No response
The text was updated successfully, but these errors were encountered: