[opensuse-factory] shell aliases and bash completions
Hi, you all know and some of you probably use variants of alias zyp='LANG=C zypper -v' alias sc='systemctl' but that sucks, when is comes to bash completions. While in theory, it should be enough to: ln -s zypper.sh /etc/bash_completion.d/zyp.sh ln -s systemctl /usr/share/bash-completion/completions/sc it's not, in fact. Something along the lines of cat > /etc/bash_completion.d/zyp.sh << EOF # zyp bash completion script . /etc/bash_completion.d/zypper.sh complete -F _zypper -o default zyp EOF cat > /usr/share/bash-completion/completions/sc << EOF # systemctl alias sc completion . /usr/share/bash-completion/completions/systemctl complete -F _systemctl sc EOF is needed. This is ugly as hell, of course. It might be possible to use relative paths here, but the general scheme is unsatisfying. Why doesn't bash simply completes from the expanded command? Or is there something less cumbersome available, that I miss here? Thanks, Pete -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
On Saturday, November 2, 2019 9:22:39 AM CDT, Hans-Peter Jansen wrote:
Hi,
you all know and some of you probably use variants of
alias zyp='LANG=C zypper -v' alias sc='systemctl'
but that sucks, when is comes to bash completions.
While in theory, it should be enough to:
ln -s zypper.sh /etc/bash_completion.d/zyp.sh ln -s systemctl /usr/share/bash-completion/completions/sc
it's not, in fact. Something along the lines of
cat > /etc/bash_completion.d/zyp.sh << EOF # zyp bash completion script . /etc/bash_completion.d/zypper.sh complete -F _zypper -o default zyp EOF
cat > /usr/share/bash-completion/completions/sc << EOF # systemctl alias sc completion . /usr/share/bash-completion/completions/systemctl complete -F _systemctl sc EOF
is needed.
This is ugly as hell, of course. It might be possible to use relative paths here, but the general scheme is unsatisfying. Why doesn't bash simply completes from the expanded command?
Or is there something less cumbersome available, that I miss here?
Thanks, Pete
Switch to zsh and put compdef zyp='zypper' in your ~/.zshrc -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
participants (2)
-
Hans-Peter Jansen
-
simonizor