I have a simple alias to copy passwords to the clipboard.
alias cpass='pass -c "$@"'
Pretty straight forward; however, I lose auto-complete which makes this alias pretty pointless. To fix this, I simply append the following to
# Autocomplete 'cpass' _completion_loader pass complete -F _pass cpass
Bash only loads an appropriate auto-complete function when the program is acted upon (e.g. entering
pass <tab>) so we need to explicitly load the function for
_completion_loader pass. We then assign
cpass the explicitly loaded function with
complete -F _pass cpass.
That’s it! Feel free to use this for any of your aliases. You can find almost all auto-complete functions in