Skip to content

Instantly share code, notes, and snippets.

@macbre
Created December 4, 2017 14:54
Show Gist options
  • Save macbre/22f2faa98fdb6902d128c8dd8b9a5952 to your computer and use it in GitHub Desktop.
Save macbre/22f2faa98fdb6902d128c8dd8b9a5952 to your computer and use it in GitHub Desktop.
_sshCompletion () # By convention, the function name
{ #+ starts with an underscore.
local cur
# Pointer to current completion word.
# By convention, it's named "cur" but this isn't strictly necessary.
COMPREPLY=() # Array variable storing the possible completions.
cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $( compgen -W 'dev-macbre cron-s1 job-s1' -- $cur ) )
# Generate the completion matches and load them into $COMPREPLY array.
# xx) May add more cases here.
# yy)
# zz)
return 0
}
complete -F _sshCompletion ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment