aboutsummaryrefslogtreecommitdiffstats
path: root/src/_pgsql_utils
diff options
context:
space:
mode:
authorJ Smith <dark.panda@gmail.com>2015-06-28 21:40:18 -0400
committerJ Smith <dark.panda@gmail.com>2015-06-28 21:40:18 -0400
commit705800ca20f8aee525dc1c25c59e94a96a670b3f (patch)
tree44876aaa340818fc9bb78b55c11e22750d86064d /src/_pgsql_utils
parentMerge pull request #324 from syohex/misspellings (diff)
downloadzsh-completions-705800ca20f8aee525dc1c25c59e94a96a670b3f.tar
zsh-completions-705800ca20f8aee525dc1c25c59e94a96a670b3f.tar.gz
zsh-completions-705800ca20f8aee525dc1c25c59e94a96a670b3f.tar.bz2
zsh-completions-705800ca20f8aee525dc1c25c59e94a96a670b3f.tar.lz
zsh-completions-705800ca20f8aee525dc1c25c59e94a96a670b3f.tar.xz
zsh-completions-705800ca20f8aee525dc1c25c59e94a96a670b3f.tar.zst
zsh-completions-705800ca20f8aee525dc1c25c59e94a96a670b3f.zip
pg_restore completion
Diffstat (limited to 'src/_pgsql_utils')
-rw-r--r--src/_pgsql_utils42
1 files changed, 41 insertions, 1 deletions
diff --git a/src/_pgsql_utils b/src/_pgsql_utils
index 6b6eed3..64cd527 100644
--- a/src/_pgsql_utils
+++ b/src/_pgsql_utils
@@ -1,4 +1,4 @@
-#compdef psql pg_dump pg_dumpall createdb dropdb vacuumdb createuser dropuser initdb
+#compdef psql pg_dump pg_dumpall pg_restore createdb dropdb vacuumdb createuser dropuser initdb
# ------------------------------------------------------------------------------
# Description
# -----------
@@ -17,6 +17,8 @@
#
# * Daniel Serodio <dserodio@gmail.com> pg_dumpall completion
#
+# * J Smith <dark.panda@gmail.com> pg_restore completion
+#
# ------------------------------------------------------------------------------
@@ -216,6 +218,43 @@ _pg_dump () {
--use-set-session-authorization'[use SET SESSION AUTHORIZATION commands instead of ALTER OWNER]'
}
+_pg_restore () {
+ local curcontext="$curcontext" state line expl
+ typeset -A opt_args
+
+ _arguments -C -s \
+ "$_pgsql_common_opts[@]" \
+ {-d+,--dbname=}':database to connect to:_pgsql_databases' \
+ {-f+,--file=}':output file:_files' \
+ {-F+,--format=}':output format:_values "format" "p[plain text]" "t[tar]" "c[custom]"' \
+ {-l,--list}'[list databases]' \
+ {-a,--data-only}'[dump only data]' \
+ {-c,--clean}'[include clean (drop) cmds before recreating]' \
+ {-C,--create}'[include createdb cmds in dump]' \
+ {-e,--exit-on-error}'[exit on error, default is to continue]' \
+ {-I,--index=}':index name:' \
+ {-j,--jobs=}':use this many parallel jobs to restore:' \
+ {-L,--use-list=}':use table of contents from this file for selecting/ordering output:' \
+ {-n,--schema=}':restore only objects in this schema:' \
+ {-O,--no-owner}'[skip restoration of object ownership]' \
+ {-P,--function=}':restore named function:' \
+ {-s,--schema-only}'[restore only the schema, no data]' \
+ {-S,--superuser=}':superuser user name to use for disabling triggers:' \
+ {-t,--table=}':restore named table:' \
+ {-T,--trigger=}':restore named trigger:' \
+ {-x,--no-privileges}'[skip restoration of access privileges (grant/revoke)]' \
+ {-1,--single-transaction}'[restore as a single transaction]' \
+ {-v,--verbose}'[verbose mode]' \
+ {-V,--version}'[display client version]' \
+ --disable-triggers'[disable triggers during data-only restore]' \
+ --if-exists'[use IF EXISTS when dropping objects]' \
+ --no-data-for-failed-tables'[do not restore data of tables that could not be created]' \
+ --no-security-labels'[do not restore security labels]' \
+ --no-tablespaces'[do not restore tablespace assignments]' \
+ --section=':dump named section:_values "section" pre-data data post-data' \
+ --use-set-session-authorization'[use SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to set ownership]'
+}
+
_pg_dumpall () {
local curcontext="$curcontext" state line expl
typeset -A opt_args
@@ -384,6 +423,7 @@ _pgsql_utils () {
case "$service" in
psql) _psql "$@" ;;
pg_dump) _pg_dump "$@" ;;
+ pg_restore) _pg_restore "$@" ;;
createdb) _createdb "$@" ;;
dropdb) _dropdb "$@" ;;
vacuumdb) _vacuumdb "$@" ;;