diff --git a/translate-shell b/translate-shell new file mode 100644 index 00000000..ca704981 --- /dev/null +++ b/translate-shell @@ -0,0 +1,19 @@ +_translate() { + COMPREPLY=() + cur=`_get_cword` + + if [ $COMP_CWORD -eq 1 ]; then + COMPREPLY=($(compgen -W "$(trans -help -no-ansi \ + | awk '{\ + for (i = 1; i <= NF; i++) {\ + if (index($i, "-") == 1) {\ + sub(/[,\.]$/, "", $i);\ + print $i\ + }\ + }\ + }')" -- "$cur")) + fi + + return 0 +} && +complete -F _translate default trans