24 lines
538 B
Plaintext
24 lines
538 B
Plaintext
_ssh() {
|
|
local cur opts
|
|
COMPREPLY=()
|
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
opts=$(grep '^Host' ~/.ssh/config ~/.ssh/config.d/* 2>/dev/null | grep -v '[?*]' | cut -d ' ' -f 2-)
|
|
COMPREPLY=( $(compgen -W "$opts" -- ${cur}) )
|
|
return 0
|
|
}
|
|
|
|
_workon() {
|
|
local cur prev envs
|
|
COMPREPLY=()
|
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
envs=$(ls /opt/pythonenv/)
|
|
|
|
COMPREPLY=( $(compgen -W "${envs}" -- ${cur}) )
|
|
}
|
|
|
|
complete -F _workon workon
|
|
complete -F _ssh ssh
|
|
complete -F _ssh sftp
|
|
|