Look for direcotries assuming a relative path.
complete -A directory echo
Look for files assuming a relative path.
complete -A file echo
Provide your own complete options. Useful for menu items that don't
change. Add -o nospace
to prevent a trailing space on your completion.
complete -W "hello hola guten\ tag nǐn\ hǎo salve asalaam\ alaikum konnichiwa olá" echo
Use a function to generate list of autocomplete values.
_echo_completions() {
COMPREPLY+=("appeal")
COMPREPLY+=("appear")
COMPREPLY+=("append")
COMPREPLY+=("apple")
COMPREPLY+=("apply")
COMPREPLY+=("bend")
}
complete -F _echo_completions echo
Smarter wordlist function that is context aware.
_echo_completions() {
COMPREPLY=($(compgen -W "appeal appear append apple apply bend" "${COMP_WORDS[1]}"))
}
complete -F _echo_completions echo
Write environment variables to a file and tail the file from another terminal.
_echo_completions() {
env > tmpfile
COMPREPLY=($(compgen -W "appeal appear append apple apply bend" "${COMP_WORDS[1]}"))
}
complete -F _echo_completions echo
See my Steam Launcher that lets you open an app by ID or game name: BlackthornYugen/autocomplete