mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-12-21 19:10:05 +08:00
Use _init_completion Support long options with or without = Auto generate options from the --help using _parse_help
24 lines
561 B
Bash
24 lines
561 B
Bash
#-*- mode: shell-script;-*-
|
|
_mdb_schema()
|
|
{
|
|
local cur prev words cword split
|
|
_init_completion -s || return
|
|
|
|
if [[ "$prev" == -@(T|-table|N|-namespace) ]] ; then
|
|
return 0
|
|
fi
|
|
|
|
$split && return
|
|
|
|
if [[ "$cur" == -* ]]; then
|
|
COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur"))
|
|
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
|
elif [[ "$prev" == @(*mdb|*mdw|*accdb) ]]; then
|
|
COMPREPLY=( $( compgen -W 'access sybase oracle postgres mysql sqlite' -- "$cur" ) )
|
|
else
|
|
_filedir '@(mdb|mdw|accdb)'
|
|
fi
|
|
return 0
|
|
} &&
|
|
complete -F _mdb_schema mdb-schema
|