summaryrefslogtreecommitdiff
path: root/completions/mysql
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gabriel@inconstante.eti.br>2017-09-25 23:46:54 -0300
committerGabriel F. T. Gomes <gabriel@inconstante.eti.br>2017-09-25 23:46:54 -0300
commit6d88f1055806932d9291f96847d2b691cccda2cd (patch)
tree0ff79eedaa8a239331256048981deedbd0721965 /completions/mysql
parent059a87a5936cfebfd2d71ab8057002cafb2ea051 (diff)
downloadbash-completion-6d88f1055806932d9291f96847d2b691cccda2cd.tar.gz
New upstream version 2.7upstream/2.7
Diffstat (limited to 'completions/mysql')
-rw-r--r--completions/mysql38
1 files changed, 21 insertions, 17 deletions
diff --git a/completions/mysql b/completions/mysql
index c41c1667..ddc94e68 100644
--- a/completions/mysql
+++ b/completions/mysql
@@ -8,38 +8,42 @@ _mysql()
case $prev in
-u|--user)
COMPREPLY=( $( compgen -u -- "$cur" ) )
- return 0
+ return
;;
-D|--database)
- COMPREPLY=( $( compgen -W "$(mysqlshow 2>/dev/null|sed -ne '2d' -e 's/^|.\([^|]*\)|.*/\1/p')" -- "$cur" ) )
- return 0
+ COMPREPLY=( $( compgen -W "$(mysqlshow 2>/dev/null | command sed -ne '2d' -e 's/^|.\([^|]*\)|.*/\1/p')" -- "$cur" ) )
+ return
;;
-h|--host)
_known_hosts_real "$cur"
- return 0
+ return
;;
--default-character-set)
- [[ -d /usr/share/mysql/charsets ]] && \
- COMPREPLY=( $( compgen -W "$(command ls /usr/share/mysql/charsets|sed -e '/^\(README\|Index\.xml\)$/d' -e 's/.xml$//') utf8" -- "$cur" ) )
- return 0
+ local reset=$( shopt -p failglob ); shopt -u failglob
+ local -a charsets=( /usr/share/m{ariadb,ysql}/charsets/*.xml )
+ $reset
+ charsets=( "${charsets[@]##*/}" )
+ charsets=( "${charsets[@]%%?(Index|\*).xml}" utf8 )
+ COMPREPLY=( $( compgen -W '${charsets[@]}' -- "$cur" ) )
+ return
;;
--character-sets-dir|--ssl-capath)
_filedir -d
- return 0
+ return
;;
-S|--socket)
_filedir sock
- return 0
+ return
;;
--protocol)
COMPREPLY=( $( compgen -W 'tcp socket pipe memory' -- "$cur" ) )
- return 0
+ return
;;
--defaults-file|--defaults-extra-file|--tee)
_filedir
- return 0
+ return
;;
--default-character-set|-P|--port|--set-variable|\
--ssl-ca|--ssl-cert|--ssl-cipher|--ssl-key|\
@@ -47,11 +51,11 @@ _mysql()
--net_buffer_length|--select_limit|--max_join_size|\
--server-arg|--debug|--delimiter|--execute|-e|--pager)
# Argument required but no completions available
- return 0
+ return
;;
'-?'|-I|--help|-V|--version)
# All other options are noop with these
- return 0
+ return
;;
esac
@@ -62,21 +66,21 @@ _mysql()
COMPREPLY=( $( compgen -W "$help" -- "$cur" ) )
[[ $COMPREPLY == *= ]] && compopt -o nospace
- return 0
+ return
;;
# only complete long options
-)
compopt -o nospace
COMPREPLY=( -- )
- return 0
+ return
;;
esac
COMPREPLY=( $( compgen -W \
- "$(mysqlshow 2>/dev/null|sed -ne '2d' -e 's/^|.\([^|]*\)|.*/\1/p')" \
+ "$(mysqlshow 2>/dev/null | command sed -ne '2d' -e 's/^|.\([^|]*\)|.*/\1/p')" \
-- "$cur" ) )
} &&
complete -F _mysql mysql
-# ex: ts=4 sw=4 et filetype=sh
+# ex: filetype=sh