summaryrefslogtreecommitdiff
path: root/Completion/Solaris/Command
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-07-21 19:15:22 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-07-21 19:15:22 +0000
commit5b29fedad850299950195a1878fe4923778f9dcc (patch)
tree100a2decba0f1b6f8c4ed1b866bddd5f2ff57019 /Completion/Solaris/Command
parent2d2d341161ca6699a6efd6981c3a9fd7fe52e6d6 (diff)
downloadzsh-5b29fedad850299950195a1878fe4923778f9dcc.tar.gz
zsh-5b29fedad850299950195a1878fe4923778f9dcc.zip
25324: Danek Duvall: some Solaris and more general completions
Diffstat (limited to 'Completion/Solaris/Command')
-rw-r--r--Completion/Solaris/Command/.distfiles15
-rw-r--r--Completion/Solaris/Command/_coreadm48
-rw-r--r--Completion/Solaris/Command/_dhcpinfo36
-rw-r--r--Completion/Solaris/Command/_dumpadm23
-rw-r--r--Completion/Solaris/Command/_gcore31
-rw-r--r--Completion/Solaris/Command/_inetadm16
-rw-r--r--Completion/Solaris/Command/_pfexec31
-rw-r--r--Completion/Solaris/Command/_ptree23
-rw-r--r--Completion/Solaris/Command/_savecore12
-rw-r--r--Completion/Solaris/Command/_svcadm70
-rw-r--r--Completion/Solaris/Command/_svccfg58
-rw-r--r--Completion/Solaris/Command/_svcprop23
-rw-r--r--Completion/Solaris/Command/_svcs32
-rw-r--r--Completion/Solaris/Command/_zlogin16
14 files changed, 434 insertions, 0 deletions
diff --git a/Completion/Solaris/Command/.distfiles b/Completion/Solaris/Command/.distfiles
new file mode 100644
index 000000000..3c606773b
--- /dev/null
+++ b/Completion/Solaris/Command/.distfiles
@@ -0,0 +1,15 @@
+DISTFILES_SRC='
+_coreadm
+_dhcpinfo
+_dumpadm
+_gcore
+_inetadm
+_pfexec
+_ptree
+_savecore
+_svcadm
+_svccfg
+_svcprop
+_svcs
+_zlogin
+'
diff --git a/Completion/Solaris/Command/_coreadm b/Completion/Solaris/Command/_coreadm
new file mode 100644
index 000000000..7cf529a4f
--- /dev/null
+++ b/Completion/Solaris/Command/_coreadm
@@ -0,0 +1,48 @@
+#compdef coreadm
+
+_coreadm() {
+ local -a content option
+
+ content=(
+ "anon[Anonymous private mappings]"
+ "ctf[CTF type information]"
+ "data[Writable private file mappings]"
+ "dism[DISM mappings]"
+ "heap[Process heap]"
+ "ism[ISM mappings]"
+ "rodata[Read-only private file mappings]"
+ "shanon[Anonymous shared mappings]"
+ "shfile[File-backed shared mappings]"
+ "shm[System V shared memory]"
+ "stack[Process stack]"
+ "symtab[Symbol table sections for loaded files]"
+ "text[Readable and executable private file mappings]"
+ )
+
+ option=(
+ "global"\:"Allow global core dumps"
+ "global-setid"\:"Allow set-id global core dumps"
+ "log"\:"Generate a syslog message on global core dump"
+ "process"\:"Allow per-process core dumps"
+ "proc-setid"\:"Allow set-id per-process core dumps"
+ )
+
+ # _values doesn't quite work for us here -- the separator can be either
+ # "+" or "-"
+ _arguments -s \
+ - set1 \
+ '-g[Global core file name pattern]:' \
+ '-G[Global core file content]:content:_values -s + "content" $content' \
+ '-i[Per-process core file name pattern]:' \
+ '-I[Per-process core file content]:content:_values -s + "content" $content' \
+ '*-d[Disable core option]:option:(($option))' \
+ '*-e[Enable core option]:option:(($option))' \
+ - set2 \
+ '-p[PID-specific per-process core file name pattern]:' \
+ '-P[PID-specific per-process core file content]:content:_values -s + "content" $content' \
+ '*:pids:_pids' \
+ - set3 \
+ '-u[Update options from coreadm.conf]'
+}
+
+_coreadm "$@"
diff --git a/Completion/Solaris/Command/_dhcpinfo b/Completion/Solaris/Command/_dhcpinfo
new file mode 100644
index 000000000..076b015b7
--- /dev/null
+++ b/Completion/Solaris/Command/_dhcpinfo
@@ -0,0 +1,36 @@
+#compdef dhcpinfo
+
+_dhcpinfo() {
+ local -a mnemonics_v4 mnemonics_v6
+
+ mnemonics_v4=(
+ Subnet UTCoffst Router Timeserv IEN116ns DNSserv Logserv
+ Cookie Lprserv Impress Resource Hostname Bootsize Dumpfile
+ DNSdmain Swapserv Rootpath ExtendP IpFwdF NLrouteF PFilter
+ MaxIpSiz IpTTL PathTO PathTbl MTU SameMtuF Broadcst
+ MaskDscF MaskSupF RDiscvyF RSolictS StaticRt TrailerF
+ ArpTimeO EthEncap TcpTTL TcpKaInt TcpKaGbF NISdmain
+ NISservs NTPservs NetBNms NetBDsts NetBNdT NetBScop
+ XFontSrv XDispMgr LeaseTim Message T1Time T2Time NW_dmain
+ NWIPOpts NIS+dom NIS+serv TFTPsrvN OptBootF MblIPAgt
+ OptBootF MblIPAgt SMTPserv POP3serv NNTPserv WWWservs
+ Fingersv IRCservs STservs STDAservs UserClas SLP_DA SLP_SS
+ AgentOpt FQDN PXEarch BootFile BootPath BootSrvA BootSrvN
+ EchoVC LeaseNeg
+ )
+
+ mnemonics_v6=(
+ ClientID ServerID Preference Unicast UserClass VendorClass
+ SIPNames SIPAddresses DNSAddresses DNSSearch NISServers
+ NIS+Servers NISDomain NIS+Domain SNTPServers InfoRefresh
+ BCMCDomain BCMCAddresses
+ )
+
+ _arguments -A \
+ '-c[]' \
+ '-i[Interface]:interface:' \
+ '-n[Maximum number of lines]:limit:' \
+ ':DHCP Parameter:_values "DHCP Parameter" $mnemonics_v4' \
+}
+
+_dhcpinfo "$@"
diff --git a/Completion/Solaris/Command/_dumpadm b/Completion/Solaris/Command/_dumpadm
new file mode 100644
index 000000000..37491946c
--- /dev/null
+++ b/Completion/Solaris/Command/_dumpadm
@@ -0,0 +1,23 @@
+#compdef dumpadm
+
+_dumpadm() {
+ local -a content
+
+ content=(
+ "kernel"\:"Kernel memory pages only"
+ "all"\:"All memory pages"
+ "curproc"\:"Kernel memory pages plus curproc pages"
+ )
+
+ _arguments -s \
+ '-n[Dont run savecore on reboot]' \
+ '-u[Update dump configuration from dumpadm.conf]' \
+ '-y[Run savecore on reboot]' \
+ '-c[Set dump content]:dump content:(($content))' \
+ '-d[Set dump device]:block devices:_files -g "*(-%b)"' \
+ '-m[Set minfree size ]:' \
+ '-s[Set the savecore directory]:directory:_files -/' \
+ '-r[Alternate root directory]:directory:_files -/'
+}
+
+_dumpadm "$@"
diff --git a/Completion/Solaris/Command/_gcore b/Completion/Solaris/Command/_gcore
new file mode 100644
index 000000000..c7b8d9466
--- /dev/null
+++ b/Completion/Solaris/Command/_gcore
@@ -0,0 +1,31 @@
+#compdef gcore
+
+_gcore() {
+ local -a content
+
+ content=(
+ "anon[Anonymous private mappings]"
+ "ctf[CTF type information]"
+ "data[Writable private file mappings]"
+ "dism[DISM mappings]"
+ "heap[Process heap]"
+ "ism[ISM mappings]"
+ "rodata[Read-only private file mappings]"
+ "shanon[Anonymous shared mappings]"
+ "shfile[File-backed shared mappings]"
+ "shm[System V shared memory]"
+ "stack[Process stack]"
+ "symtab[Symbol table sections for loaded files]"
+ "text[Readable and executable private file mappings]"
+ )
+
+ _arguments -s \
+ '-p[Use per-process core file repository]' \
+ '-g[Use global core file repository]' \
+ '-F[Force grabbing the target process]' \
+ '-c[Set core file content]:_values -s + "content" $content' \
+ '-o[Set core file base name]:' \
+ '*:pids:_pids'
+}
+
+_gcore "$@"
diff --git a/Completion/Solaris/Command/_inetadm b/Completion/Solaris/Command/_inetadm
new file mode 100644
index 000000000..2588672ef
--- /dev/null
+++ b/Completion/Solaris/Command/_inetadm
@@ -0,0 +1,16 @@
+#compdef inetadm
+
+_inetadm() {
+ _arguments -s \
+ '-?[Help]' \
+ '-l[List service instance properties]:FMRI:_svcs_fmri -i' \
+ '-e[Enable specified instance]:FMRI:_svcs_fmri -i' \
+ '-d[Disable specified instance]:FMRI:_svcs_fmri -i' \
+ '-p[List inet service properties]' \
+ '-m[Modify service instance properties]:FMRI:_svcs_fmri -i' \
+ '-M[Modify inet service properties]'
+}
+
+_inetadm "$@"
+
+# vi:tw=0
diff --git a/Completion/Solaris/Command/_pfexec b/Completion/Solaris/Command/_pfexec
new file mode 100644
index 000000000..227336223
--- /dev/null
+++ b/Completion/Solaris/Command/_pfexec
@@ -0,0 +1,31 @@
+#compdef pfexec
+
+# This is a _values-like function that completes privileges and !-prefixed
+# privileges, comma-separated, and unique.
+_privset() {
+ local expl p
+ local -a privs
+
+ privs=( ${(f)"$(ppriv -l)"} all none zone basic )
+
+ # Ignore existing values
+ compset -P '*,'
+ # Ignore a leading !, maybe backslash-quoted
+ compset -P '\\#!'
+
+ # Remove already-referenced privs
+ for p in ${(s:,:)${IPREFIX//\\#\!/}}; do
+ privs=( ${privs:#$p} )
+ done
+
+ _wanted privs expl 'privilege' compadd -qS , -a privs
+}
+
+_pfexec() {
+ _arguments \
+ '-P[privileges to acquire]:privspec:_privset' \
+ '(-):command name: _command_names -e' \
+ '*::arguments: _normal'
+}
+
+_pfexec "$@"
diff --git a/Completion/Solaris/Command/_ptree b/Completion/Solaris/Command/_ptree
new file mode 100644
index 000000000..c75a211c4
--- /dev/null
+++ b/Completion/Solaris/Command/_ptree
@@ -0,0 +1,23 @@
+#compdef ptree
+
+_ptree() {
+ local curcontext="$curcontext" context state line ret=1
+ typeset -A opt_args
+
+ _arguments -s \
+ '-a[All processes]' \
+ '-c[Show contract memberships]' \
+ '-z[Show processes in zone]:zone:($(zoneadm list))' \
+ '*:pid or user:->pidoruser' && ret=0
+
+ if [[ $ret -ne 0 ]]; then
+ _alternative \
+ 'users:logged-in user:(${$(who -q)\:#(users=*|\#)})' \
+ 'pids:pid:_pids'
+ ret=$?
+ fi
+
+ return $ret
+}
+
+_ptree "$@"
diff --git a/Completion/Solaris/Command/_savecore b/Completion/Solaris/Command/_savecore
new file mode 100644
index 000000000..63bb81fb7
--- /dev/null
+++ b/Completion/Solaris/Command/_savecore
@@ -0,0 +1,12 @@
+#compdef savecore
+
+_savecore() {
+ _arguments -s \
+ '-L[Take live dump]' \
+ '-v[Verbose]' \
+ '-d[Disregard dump header valid flag]' \
+ '-f[Save crash dump from file]:file:_files' \
+ '::directory:_files -/'
+}
+
+_savecore "$@"
diff --git a/Completion/Solaris/Command/_svcadm b/Completion/Solaris/Command/_svcadm
new file mode 100644
index 000000000..c2e91a6fe
--- /dev/null
+++ b/Completion/Solaris/Command/_svcadm
@@ -0,0 +1,70 @@
+#compdef svcadm
+
+_svcadm() {
+ local context state line subcmds
+ typeset -A opt_args
+
+ subcmds=( enable disable restart refresh mark clear milestone )
+
+ if [[ $service == "svcadm" ]]; then
+ _arguments -C -A "-*" \
+ '-v[Print actions verbosely]' \
+ '*::command:->subcmd' && return 0
+
+ if (( CURRENT == 1 )); then
+ _wanted commands expl 'svcadm subcommand' compadd -a subcmds
+ return
+ fi
+ service="$words[1]"
+ curcontext="${curcontext%:*}=$service:"
+ fi
+
+ case $service in
+ (enable)
+ _arguments \
+ '-r[Recursively enable dependencies]' \
+ '-s[Wait for service to come online]' \
+ '-t[State change is temporary]' \
+ '*:instance FMRI:_svcs_fmri -i'
+ ;;
+
+ (disable)
+ _arguments \
+ '-s[Wait for service to become disabled]' \
+ '-t[State change is temporary]' \
+ '*:instance FMRI:_svcs_fmri -i'
+ ;;
+
+ (mark)
+ _arguments \
+ '-I[Change state immediately]' \
+ '-t[State change is temporary]' \
+ ':state:(degraded maintenance)' \
+ ':instance FMRI:_svcs_fmri -i'
+ ;;
+
+ (restart|refresh|clear)
+ _arguments \
+ '*:instance FMRI:_svcs_fmri -i'
+ ;;
+
+ (milestone)
+ _arguments \
+ '-d[Make milestone the default]' \
+ '*:milestone FMRI:_svcs_fmri -m'
+ ;;
+
+# # The delegate subcommand has been removed, replaced by just using
+# # the restarter fmri
+# (delegate)
+# _arguments \
+# '1:restarter FMRI:_svcs_fmri -r' \
+# '*:instance FMRI:_svcs_fmri -i'
+# ;;
+
+ (*)
+ _message "unknown svcadm subcommand: $service"
+ esac
+}
+
+_svcadm "$@"
diff --git a/Completion/Solaris/Command/_svccfg b/Completion/Solaris/Command/_svccfg
new file mode 100644
index 000000000..59f275f26
--- /dev/null
+++ b/Completion/Solaris/Command/_svccfg
@@ -0,0 +1,58 @@
+#compdef svccfg
+
+_svccfg() {
+ local context state line subcmds
+
+ subcmds=( apply extract import validate export inventory delete addpropvalue delpropvalue )
+
+ if [[ $service == "svccfg" ]]; then
+ _arguments -s \
+ '-?[Help]' \
+ '-v[Verbose]' \
+ '-s[FMRI on which to operate]:fmri:_svcs_fmri -c' \
+ - set1 \
+ '-f[Read commands from file]:command file:_files' \
+ - set2 \
+ '*::command:->subcmd' && return 0
+
+ if (( CURRENT == 1 )); then
+ _wanted commands expl 'svccfg subcommand' compadd -a subcmds
+ return
+ fi
+ service="$words[1]"
+ curcontext="${curcontext%:*}=$service:"
+ fi
+
+ case $service in
+ (import)
+ _arguments \
+ '-V[Verify property updates]' \
+ ':file:_files'
+ ;;
+
+ (apply|validate|inventory)
+ _files
+ ;;
+
+ (export)
+ _svcs_fmri -c
+ ;;
+
+ (delete)
+ _arguments \
+ '-f[Force deletion if online or degraded]' \
+ '*:FMRI:_svcs_fmri -c'
+ ;;
+
+ (extract)
+ ;;
+
+ (*)
+ _message "unknown svccfg subcommand: $service"
+ ;;
+ esac
+}
+
+_svccfg "$@"
+
+# vi:tw=0
diff --git a/Completion/Solaris/Command/_svcprop b/Completion/Solaris/Command/_svcprop
new file mode 100644
index 000000000..aa166808a
--- /dev/null
+++ b/Completion/Solaris/Command/_svcprop
@@ -0,0 +1,23 @@
+#compdef svcprop
+
+_svcprop() {
+ _arguments -s \
+ '-f[Designate properties by their FMRI]' \
+ '-q[Quiet]' \
+ '-t[Use multi-property output format]' \
+ '-v[Verbose]' \
+ - set1 \
+ '-w[Waits for the selected property or property group to change]' \
+ '-p[Prints values of named property or property group]' \
+ ':FMRI:_svcs_fmri -i' \
+ - set2 \
+ '(-c -s)-C[Retrieve properties without composition]' \
+ '(-C -s)-c[Retrieve properties with composition]' \
+ '(-c -C)-s[Retrieve properties from snapshot]:snapshot:' \
+ '*-p[Prints values of named property or property group]' \
+ '*:FMRI:_svcs_fmri -i'
+}
+
+_svcprop "$@"
+
+# vi:tw=0
diff --git a/Completion/Solaris/Command/_svcs b/Completion/Solaris/Command/_svcs
new file mode 100644
index 000000000..0fcad2628
--- /dev/null
+++ b/Completion/Solaris/Command/_svcs
@@ -0,0 +1,32 @@
+#compdef svcs
+
+_svcs() {
+ local -a cols
+
+ cols=(
+ ctid\:"Contract ID" desc\:"Description" fmri\:"FMRI"
+ inst\:"Instance name" nsta\:"Next state (abbr)" nstate\:"Next state"
+ scope\:"Scope name" svc\:"Service name" sta\:"State (abbr)"
+ state\:"State" stime\:"Start time"
+ )
+
+ _arguments -s \
+ '(-l -x -d -D)-a[List all instances]' \
+ '(-l -x -D -a -R)-d[List dependencies]' \
+ '(-l -x -d -a -R)-D[List dependents]' \
+ '(-l -x)-H[Suppress header line]' \
+ '(-)-l[Print detailed status about services and instances]' \
+ '(-l -x)-o[Display specific columns]:column:_values -s , "column" ${^cols/\:/[}\]' \
+ '(-l -x)-p[List processes]' \
+ '(-l -x -d -D)-R[List services with the given restarter]:instance FMRI:_svcs_fmri -i' \
+ '(-l -x)-s[Sort by a column]:column:(($cols))' \
+ '(-l -x)-S[Reverse sort by a column]:column:(($cols))' \
+ '(-l)-v[verbose columns]' \
+ '(-l)-x[Display explanation for service states]' \
+ '(-l -x)-\?[Print help]' \
+ '*:FMRI or pattern:_svcs_fmri -i'
+}
+
+_svcs "$@"
+
+# vi:tw=0
diff --git a/Completion/Solaris/Command/_zlogin b/Completion/Solaris/Command/_zlogin
new file mode 100644
index 000000000..9e93684b8
--- /dev/null
+++ b/Completion/Solaris/Command/_zlogin
@@ -0,0 +1,16 @@
+#compdef zlogin
+
+_zlogin() {
+ _arguments -s \
+ '-E[Disable escape character]' \
+ '-e[Specify escape character]:character:' \
+ '-l[Specify username]:username:_users' \
+ ':zonename:' \
+ - set1 \
+ '-C[Connect to zone console]' \
+ - set2 \
+ '-S["Safe" login mode]' \
+ ':utility'
+}
+
+_zlogin "$@"