Skip to main content
Alioth → Salsa.
Source Link
Stephen Kitt
  • 481.5k
  • 60
  • 1.2k
  • 1.4k

The magic is in the _init_completion function which is defined in the bash_completion file of the bash-completion packagebash_completion file of the bash-completion package.

There's no easy way out. If you want sensible fancy completion in bash, install the bash-completion package. Then define a function:

. /etc/bash_completion
_my_mysql () {
  local cur prev words cword
  _init_completion || return
  COMPREPLY=($(compgen -W 'firstdatabase databasetwo etc' "$cur"))
}
complete -F _my_mysql mysql

The magic is in the _init_completion function which is defined in the bash_completion file of the bash-completion package.

There's no easy way out. If you want sensible fancy completion in bash, install the bash-completion package. Then define a function:

. /etc/bash_completion
_my_mysql () {
  local cur prev words cword
  _init_completion || return
  COMPREPLY=($(compgen -W 'firstdatabase databasetwo etc' "$cur"))
}
complete -F _my_mysql mysql

The magic is in the _init_completion function which is defined in the bash_completion file of the bash-completion package.

There's no easy way out. If you want sensible fancy completion in bash, install the bash-completion package. Then define a function:

. /etc/bash_completion
_my_mysql () {
  local cur prev words cword
  _init_completion || return
  COMPREPLY=($(compgen -W 'firstdatabase databasetwo etc' "$cur"))
}
complete -F _my_mysql mysql
Source Link
Gilles 'SO- stop being evil'
  • 865.5k
  • 205
  • 1.8k
  • 2.3k

The magic is in the _init_completion function which is defined in the bash_completion file of the bash-completion package.

There's no easy way out. If you want sensible fancy completion in bash, install the bash-completion package. Then define a function:

. /etc/bash_completion
_my_mysql () {
  local cur prev words cword
  _init_completion || return
  COMPREPLY=($(compgen -W 'firstdatabase databasetwo etc' "$cur"))
}
complete -F _my_mysql mysql