From feb7dd2c70c9a45878c094bb8f8c2c3b98400fee Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Sep 2013 00:04:10 +1200 Subject: Move SSH completion into its own file --- bash/bashrc.d/completion.bash | 31 ------------------------------- 1 file changed, 31 deletions(-) (limited to 'bash/bashrc.d/completion.bash') diff --git a/bash/bashrc.d/completion.bash b/bash/bashrc.d/completion.bash index a921770b..6a382a37 100644 --- a/bash/bashrc.d/completion.bash +++ b/bash/bashrc.d/completion.bash @@ -22,34 +22,3 @@ complete -c sudo # unset with shell variables and functions complete -v -A function unset -# ssh/sftp/ssh-copy-id with config hostnames -_ssh() { - local word config hosts option value - word=${COMP_WORDS[COMP_CWORD]} - config=$HOME/.ssh/config - hosts=() - - # Bail if the configuration file is illegible - if [[ ! -r $config ]]; then - return 1 - fi - - # Read hostnames from the file, no asterisks - while read -r option value _; do - if [[ $option == Host && $value != *'*'* ]]; then - hosts[${#hosts[@]}]=$value - fi - done < "$config" - - # Generate completion reply - COMPREPLY=( $(compgen -W "${hosts[*]}" -- "$word") ) -} -complete -F _ssh ssh sftp ssh-copy-id - -# scp/rsync with local files and hostnames (colon suffixes) -_scp() { - _ssh - COMPREPLY=( "${COMPREPLY[@]/%/:}" ) -} -complete -f -F _scp scp - -- cgit v1.2.3