Files
mdbtools/src/util/bash-completion/mdb-export
2020-10-25 12:09:51 +01:00

36 lines
1.2 KiB
Bash

#-*- 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|-quote|X|-escape|N|-namespace|S|-batch-size|D|-date-format|T|-datetime-format|0|-null|h|-help) ]] ; then
return 0
elif [[ "$prev" == -@(I|-insert) ]] ; then
COMPREPLY=( $( compgen -W 'access sybase oracle postgres mysql sqlite' -- $cur ) )
elif [[ "$prev" == -@(b|-bin) ]] ; then
COMPREPLY=( $( compgen -W 'strip raw octal hex' -- $cur ) )
elif [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-H -d -R -Q -q -X -I -N -S -D -T -0 -B -h \
--no-header --delimiter --row-delimiter \
--no-quote --quote --escape \
--insert --namespace --batch-size \
--date-format --datetime-format \
--null --bin --boolean-words
--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