mirror of
https://github.com/mdbtools/mdbtools.git
synced 2026-01-02 12:27:09 +08:00
32 lines
1.0 KiB
Plaintext
32 lines
1.0 KiB
Plaintext
|
|
#-*- mode: shell-script;-*-
|
||
|
|
_mdb_export()
|
||
|
|
{
|
||
|
|
local cur prev
|
||
|
|
COMPREPLY=()
|
||
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
||
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||
|
|
|
||
|
|
if [[ "$prev" == -@(d|-delimiter|R|-row-delimiter|q|-quote|X|-escape|D|-date-format|N|-namespace|h|-help) ]] ; then
|
||
|
|
return 0
|
||
|
|
elif [[ "$prev" == -I ]] ; then
|
||
|
|
COMPREPLY=( $( compgen -W 'access sybase oracle postgres mysql' -- $cur ) )
|
||
|
|
elif [[ "$prev" == -@(b|-bin) ]] ; then
|
||
|
|
COMPREPLY=( $( compgen -W 'strip raw octal' -- $cur ) )
|
||
|
|
elif [[ "$cur" == -* ]]; then
|
||
|
|
COMPREPLY=( $( compgen -W '-H -d -R -Q -q -X -I -D -N -b -h \
|
||
|
|
--no-header --no-quote --delimiter --row-delimiter --insert \
|
||
|
|
--date-format --quote --escape --namespace --bin --help' -- $cur ) )
|
||
|
|
elif [[ "$prev" == *@(mdb|mdw|accdb) ]] ; then
|
||
|
|
local dbname
|
||
|
|
local tablenames
|
||
|
|
dbname=$prev
|
||
|
|
__expand_tilde_by_ref dbname
|
||
|
|
tablenames=$(eval mdb-tables -S -d / "${dbname}" 2>/dev/null)
|
||
|
|
COMPREPLY=( $( IFS=/ compgen -W "${tablenames}" -- $cur ) )
|
||
|
|
else
|
||
|
|
_filedir '@(mdb|mdw|accdb)'
|
||
|
|
fi
|
||
|
|
return 0
|
||
|
|
} &&
|
||
|
|
complete -F _mdb_export mdb-export
|