complete
Get and set argument autocompletion rules of shell commands in Bash. tldr-pages
On several platforms
Several platforms
Get and set argument autocompletion rules of shell commands in Bash. The specified completions will be invoked when <Tab> is pressed in Bash.
Set arguments of a command to autocomplete through a function (completion response is sent in $COMPREPLY variable)
complete -F function commandIdentifySet arguments of a command to autocomplete through another command ($1 is the command, $2 is the argument the cursor is on, and $3 is the argument preceding the cursor)
complete -C autocomplete_command commandIdentifySet arguments of a command to autocomplete to shell builtins
complete -b commandIdentifyApply autocompletion without appending a space to the completed word
complete -o nospace -F function commandIdentifyList all loaded complete specifications
complete -pIdentifyList loaded complete specifications for a command
complete -p commandIdentify