| 1 |
#-*- mode: shell-script;-*- |
| 2 |
_mdb_export() |
| 3 |
{ |
| 4 |
local cur prev words cword split |
| 5 |
_init_completion -s || return |
| 6 |
|
| 7 |
if [[ "$prev" == -@(d|-delimiter|R|-row-delimiter|q|-quote|X|-escape|N|-namespace|S|-batch-size|D|-date-format|T|-datetime-format|0|-null|h|-help) ]] ; then |
| 8 |
return 0 |
| 9 |
elif [[ "$prev" == -@(I|-insert) ]] ; then |
| 10 |
COMPREPLY=( $( compgen -W 'access sybase oracle postgres mysql sqlite' -- "$cur" ) ) |
| 11 |
elif [[ "$prev" == -@(b|-bin) ]] ; then |
| 12 |
COMPREPLY=( $( compgen -W 'strip raw octal hex' -- "$cur" ) ) |
| 13 |
fi |
| 14 |
|
| 15 |
$split && return |
| 16 |
|
| 17 |
if [[ "$cur" == -* ]]; then |
| 18 |
COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) |
| 19 |
[[ $COMPREPLY == *= ]] && compopt -o nospace |
| 20 |
elif [[ "$prev" == *@(mdb|mdw|accdb) ]] ; then |
| 21 |
local dbname |
| 22 |
local tablenames |
| 23 |
dbname=$prev |
| 24 |
__expand_tilde_by_ref dbname |
| 25 |
local IFS=$'\n' |
| 26 |
tablenames="$(eval mdb-tables -S -1 "${dbname}" 2>/dev/null)" |
| 27 |
compopt -o filenames |
| 28 |
COMPREPLY=( $( compgen -W '${tablenames}' -- "$cur" ) ) |
| 29 |
else |
| 30 |
_filedir '@(mdb|mdw|accdb)' |
| 31 |
fi |
| 32 |
return 0 |
| 33 |
} && |
| 34 |
complete -F _mdb_export mdb-export |