--- /dev/null
+#!/bin/bash
+#
+# This file provides programmable completion for repo-encrypt under
+# the bash shell
+
+function _mosh {
+
+ local cmd cur prev line subcmds opts
+ COMPREPLY=()
+ cmd="${1##*/}"
+ cur="${COMP_WORDS[COMP_CWORD]}" # called 'cur' by convention [1]
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ line="${COMP_LINE}"
+ subcmds="encrypt decrypt"
+ opts="--help"
+
+ if [[ "$COMP_CWORD" == 1 ]]; then
+ COMPREPLY=($(compgen -W "${subcmds} ${opts}" -- "${cur}"))
+ return 0
+ elif [[ ${COMP_WORDS[1]} == "--help" ]]; then
+ COMPREPLY=(" ") # none empty
+ >&2 printf "\n${cmd}: No completion on '--help'"
+ return 0
+ fi
+
+ return 0
+}
+
+complete -o filenames -o default -F _repo-encrypt repo-encrypt # There are details [2]
+
+# cat ~/.ssh/config | sed -n '/^[[:space:]]*[Hh]ost/ {s/#.*$//g; s/\*//g; s/[Hh]ost\([Nn]ame\)*//g; s/[[:space:]]/\n/g; p}' |sort -u | less
+
+# [1]: http://tldp.org/LDP/abs/html/tabexpansion.html
+# [2]: http://www.gnu.org/software/bash/manual/bash.html#Programmable-Completion