mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 09:06:44 +00:00
1Password's shell plugin integration is nice, but it currently uses aliases to run various CLI tools through `op plugin run -- <tool>`. This leads to shell completion for those tools not working correctly in bash and zsh. While zsh can work around that with `setopt completealiases`, it causes shorthand aliases to break instead. Hence the only reasonable solution is to replace the aliases with shell functions. Previously I had manually been editing ~/.config/op/plugins.sh replacing the aliases with functions. This is an automated solution that generates unalias calls and function definitions for all 1Password aliases. It is also efficient by means of writing the generated functions to a cache file which is only updated when needed.