aboutsummaryrefslogtreecommitdiffstats
path: root/src/_pgsql_utils
diff options
context:
space:
mode:
authorJ Smith <dark.panda@gmail.com>2012-09-10 01:02:50 -0400
committerJ Smith <dark.panda@gmail.com>2012-09-10 01:18:33 -0400
commit603bd2f4e17745509d9e3500059e56cb5eac96de (patch)
tree2056c5adadd21cae6c5c1fff0bb560b2c3c17e94 /src/_pgsql_utils
parentAdd the createuser and dropuser commands. (diff)
downloadzsh-completions-603bd2f4e17745509d9e3500059e56cb5eac96de.tar
zsh-completions-603bd2f4e17745509d9e3500059e56cb5eac96de.tar.gz
zsh-completions-603bd2f4e17745509d9e3500059e56cb5eac96de.tar.bz2
zsh-completions-603bd2f4e17745509d9e3500059e56cb5eac96de.tar.lz
zsh-completions-603bd2f4e17745509d9e3500059e56cb5eac96de.tar.xz
zsh-completions-603bd2f4e17745509d9e3500059e56cb5eac96de.tar.zst
zsh-completions-603bd2f4e17745509d9e3500059e56cb5eac96de.zip
Add the initdb command.
Diffstat (limited to 'src/_pgsql_utils')
-rw-r--r--src/_pgsql_utils49
1 files changed, 47 insertions, 2 deletions
diff --git a/src/_pgsql_utils b/src/_pgsql_utils
index 1b2d3b4..1f95130 100644
--- a/src/_pgsql_utils
+++ b/src/_pgsql_utils
@@ -1,4 +1,4 @@
-#compdef psql pg_dump createdb dropdb vacuumdb createuser dropuser
+#compdef psql pg_dump createdb dropdb vacuumdb createuser dropuser initdb
# ------------------------------------------------------------------------------
# Description
# -----------
@@ -266,8 +266,36 @@ _dropuser () {
':PostgreSQL user:_pgsql_users'
}
+_initdb () {
+ local curcontext="$curcontext" state line expl
+ typeset -A opt_args
+
+ _arguments -C -s \
+ {--auth=,-A+}':default authentication method for local connections:_values "auth methods" $_pgsql_auth_methods[@]' \
+ {-D+,--pgdata=}':location for this database cluster:_files' \
+ {-E+,--encoding=}':set default encoding for new databases:' \
+ --locale=':set default locale for new databases:' \
+ --lc-collate=':set the default locale for collate:' \
+ --lc-ctype=':set the default locale for ctype:' \
+ --lc-messages=':set the default locale for messages:' \
+ --lc-monetary=':set the default locale for monetary:' \
+ --lc-numeric=':set the default locale for numeric:' \
+ --lc-time=':set the default local for time:' \
+ --no-locale'[equivalent to --locale=C]' \
+ --pwfile=':read password for the new superuser from file:_files' \
+ {-T+,--text-search-config=}'[default text search configuration]' \
+ {-U+,--username=NAME}':database superuser name:' \
+ {-W,--pwprompt}'[prompt for a password for the new superuser]' \
+ {-X+,--xlogdir=}':location for the transaction log directory:_files' \
+ {-d,--debug}'[generate lots of debugging output]' \
+ -L+':where to find the input files:_files' \
+ {-n,--noclean}'[do not clean up after errors]' \
+ {-s,--show}'[show internal settings]' \
+ ':location for this database cluster:_files'
+}
+
_pgsql_utils () {
- local _pgsql_common_opts
+ local _pgsql_common_opts _pgsql_auth_methods
_pgsql_common_opts=(
{-\?,--help}'[display help]'
@@ -277,6 +305,22 @@ _pgsql_utils () {
{-W,--password}'[prompt for password]'
)
+ _pgsql_auth_methods=(
+ trust
+ reject
+ md5
+ password
+ gss
+ sspi
+ krb5
+ ident
+ peer
+ ldap
+ radius
+ cert
+ pam
+ )
+
case "$service" in
psql) _psql "$@" ;;
pg_dump) _pg_dump "$@" ;;
@@ -285,6 +329,7 @@ _pgsql_utils () {
vacuumdb) _vacuumdb "$@" ;;
createuser) _createuser "$@" ;;
dropuser) _dropuser "$@" ;;
+ initdb) _initdb "$@" ;;
esac
}