You are not logged in.
Pages: 1
It is possible to make bash's auto-completion to work with an alias? Like:
alias install="sudo pacman -S"
install firef[TAB]
Offline
I guess you already installed the bash-completion package and sourced /etc/bash_completion in your .bashrc?
Most of the bash completion abilities are provided by functions. For instance, the completion function for pacman is defined in /etc/bash_completion.d/pacman, which get's included by /etc/bash_completion.
To get the completion for your alias, you have to write a new wrapper function for _available_pkgs (also defined in that file):
_install_pkgs () {
COMPREPLY=()
cur=`_get_cword`
_available_pkgs
}
Finally, you have to tell bash to use that function for your alias:
complete -F _install_pkgs install
Put both in your .bashrc or in /etc/bash_completion or in /etc/bash_completion.d/pacman, considering that the last two might get overwritten by an update.
Offline
you could also use zsh instead of bash which, iirc, comes with alias and pacman (command and package name) completion preconfigured.
Of course it has many other perks.
no place like /home
github
Offline
Pages: 1