about summary refs log tree commit diff
path: root/Completion/Linux
diff options
context:
space:
mode:
authorPaul Ackersviller <packersv@users.sourceforge.net>2007-10-29 20:39:15 +0000
committerPaul Ackersviller <packersv@users.sourceforge.net>2007-10-29 20:39:15 +0000
commit234a0acea79d8f79032f6cbda88e7720984b87e8 (patch)
treee71434dc815b245349d6c880b95807c74d37017c /Completion/Linux
parent52f25ab3d2d81a7c3172a54e3c0824de40b30270 (diff)
downloadzsh-234a0acea79d8f79032f6cbda88e7720984b87e8.tar.gz
zsh-234a0acea79d8f79032f6cbda88e7720984b87e8.tar.xz
zsh-234a0acea79d8f79032f6cbda88e7720984b87e8.zip
Merge new completions 22794, 22797, 22798, 22799, and 22800 onto 4.2 branch.
Diffstat (limited to 'Completion/Linux')
-rw-r--r--Completion/Linux/Command/_acpitool69
-rw-r--r--Completion/Linux/Command/_fusermount26
-rw-r--r--Completion/Linux/Type/_fuse_arguments53
-rw-r--r--Completion/Linux/Type/_fuse_values70
-rw-r--r--Completion/Linux/Type/_wakeup_capable_devices15
5 files changed, 233 insertions, 0 deletions
diff --git a/Completion/Linux/Command/_acpitool b/Completion/Linux/Command/_acpitool
new file mode 100644
index 000000000..e7dcb4ea1
--- /dev/null
+++ b/Completion/Linux/Command/_acpitool
@@ -0,0 +1,69 @@
+#compdef acpitool
+
+local ret=1 selbrands disambig
+typeset -a brands args
+
+if ! zstyle -a ":completion:${curcontext}:" acpi-extensions brands || \
+  (( $brands[(I)detect] )); then
+  [[ -d /proc/acpi/toshiba ]] && brands+=toshiba
+  [[ -d /proc/acpi/asus ]] && brands+=asus
+  [[ -d /proc/acpi/ibm ]] && brands+=thinkpad
+elif (( $brands[(I)all] )); then
+  brands=(toshiba asus thinkpad)
+fi
+
+args=(
+  '(-a --ac_adapter)'{-a,--ac_adapter}'[show AC adapter presence]'
+  '-b[show battery status for available batteries]'
+  '(-B --battery)'{-B,--battery}'[show detailed battery status for all batteries found]'
+  '(-c --cpu)'{-c,--cpu}'[show CPU information]'
+  '(-a --ac_adapter -A -b -B --battery -c --cpu -e -f --fan -t --thermal -w)-e[show just about everything]'
+  '(-f --fan)'{-f,--fan}'[show fan status]'
+  '(-h --help)'{-h,--help}'[display help]'
+  '(-s --suspend)'{-s,--suspend}'[suspend machine to memory (sleep state S3)]'
+  '-S[suspend machine to disk (sleep state S4)]'
+  '(-t --thermal)'{-t,--thermal}'[show thermal zone(s) information and trip points]'
+  '-v[show more verbose output]'
+  '(-V --version)'{-V,--version}'[output version information and exit]'
+  '-w[show the wakeup capable devices]'
+  '-W+[toggle enable/disable wakeup capable device]: :_wakeup_capable_devices'
+)
+
+if (( $brands[(I)asus] )); then
+  disambig=
+  (( $brands[(I)(toshiba|thinkpad)] )) && disambig='Asus '
+  args+=(
+    '(-A --Asus)'{-A,--Asus}'[show supported Asus ACPI extensions]'
+    '-m+[set mail LED status]:mail LED status:((1\:on 0\:off))'
+    '-n+[set wireless LED status]:wireless LED status:((1\:on 0\:off))'
+    '-o+[set LCD panel status]:LCD panel status:((1\:on 0\:off))'
+    "-z+[set ${disambig}LCD brightness level]:${disambig}LCD brightness level:(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)"
+  )
+fi
+
+selbrands=
+if (( $brands[(I)toshiba] )); then
+  selbrands=Toshiba
+  args+=(
+    '-F+[force fan on or switch back to auto mode]:fan status:((1\:on 0\:auto))'
+    '(-T --Toshiba)'{-T,--Toshiba}'[show supported Toshiba ACPI extensions]'
+  )
+fi
+
+if (( $brands[(I)thinkpad] )); then
+  [[ -n $selbrands ]] && selbrands+=/
+  selbrands=${selbrands}Thinkpad
+  args+=('-j[eject ultrabay device]')
+fi
+
+if [[ -n $selbrands ]]; then
+  disambig=
+  (( $brands[(I)asus] )) && disambig="$selbrands "
+  args+=(
+    "-l+[set ${disambig}LCD brightness level]:${disambig}LCD brightness level:(0 1 2 3 4 5 6 7)"
+  )
+fi
+
+_arguments -s $args && ret=0
+
+return ret
diff --git a/Completion/Linux/Command/_fusermount b/Completion/Linux/Command/_fusermount
new file mode 100644
index 000000000..d3d1647fa
--- /dev/null
+++ b/Completion/Linux/Command/_fusermount
@@ -0,0 +1,26 @@
+#compdef fusermount
+
+local expl context state line
+typeset -A opt_args
+
+_arguments \
+  '-h[display help information]' \
+  '-V[display version information]' \
+  '-o[specify mount options]:mount options:_fuse_values "mount options"' \
+  '-u[unmount a fuse mount]' \
+  '-z[unmount lazily (work even when if the resource is still busy)]' \
+  '-q[suppress nonessential output]' \
+  ':mount point:->mountpoint' && return 0
+
+typeset -a mtpts
+
+case "$state" in
+  (mountpoint)
+  if [[ $+opt_args[-u] -eq 0 ]]; then
+    _files -/
+  else
+    mtpts=(${${${"${(f)$(< /etc/mtab)}"}#* }%% *})
+    _canonical_paths mounted 'mounted filesystem' $mtpts
+  fi
+  ;;
+esac
diff --git a/Completion/Linux/Type/_fuse_arguments b/Completion/Linux/Type/_fuse_arguments
new file mode 100644
index 000000000..b5c21a5e2
--- /dev/null
+++ b/Completion/Linux/Type/_fuse_arguments
@@ -0,0 +1,53 @@
+#autoload
+
+local ret long rawret nm=${compstate[nmatches]} fsopt cvalsvar
+typeset -a fargs opts
+
+fargs=(
+  '(-d -f)-d[enable debug output]'
+  '-f[enable foreground operation]'
+  '-r[mount filesystem read-only]'
+  '-s[disable multi-threaded operation]'
+  '(-h --help)'{-h,--help}'[display help and exit]'
+  '(-V --version)'{-V,--version}'[show version information and exit]'
+)
+
+(( $# )) || fargs+='*:default: _default'
+
+long=$argv[(I)--]
+if (( long )); then
+  argv[long]=($fargs --)
+else
+  set -- "$@" $fargs
+fi
+
+while [[ $1 == -(O*|F*|[CRWsw]) ]]; do
+  if [[ $1 == -F?* ]]; then
+    cvalsvar=${1[3,-1]}
+  elif [[ $1 == -F ]]; then
+    cvalsvar=$2
+    shift
+  else
+    opts+=$1
+    [[ $1 == -R ]] && rawret=yes
+  fi
+  shift
+done
+
+if [[ $cvalsvar != - ]]; then
+  fsopt='*-o[specify mount options]:mount option:_fuse_values'
+  [[ -n $cvalsvar ]] && fsopt+=" -A $cvalsvar"
+  fsopt+=' mount\ option'
+  set -- "$@" $fsopt
+fi
+
+_arguments -R $opts "$@"
+
+ret=$?
+
+if [[ $ret == 300 ]]; then
+  compstate[restore]=
+  [[ -z $rawret ]] && ret=$(( nm == $compstate[nmatches] ))
+fi
+
+return ret
diff --git a/Completion/Linux/Type/_fuse_values b/Completion/Linux/Type/_fuse_values
new file mode 100644
index 000000000..be830cb40
--- /dev/null
+++ b/Completion/Linux/Type/_fuse_values
@@ -0,0 +1,70 @@
+#autoload
+
+local ret stateset fvals cvalsvar cvalind
+typeset -a fvals opts
+
+if [[ $1 = -O* ]]; then
+  opts+=$1
+  shift
+fi
+opts+=(-s , -S =)
+
+cvalind=$argv[(I)-A*]
+
+while (( cvalind )); do
+  if [[ ${(P)cvalind} = -A?* ]]; then
+    cvalsvar=${(P)cvalind[3,-1]}
+    argv[cvalind]=()
+  else
+    cvalsvar=$argv[cvalind+1]
+    argv[cvalind,cvalind+1]=()
+  fi
+  cvalind=$argv[(I)-A*]
+done
+
+fvals=(
+  'ro[mount filesystem read-only]'
+  'allow_other[allow access to other users]'
+  'allow_root[allow access to root]'
+  'nonempty[allow mounts over non-empty file/dir]'
+  'default_permissions[enable permission checking by kernel]'
+  'fsname[set filesystem name]:name'
+  'large_read[issue large read requests (linux v2.4 only)]'
+  'max_read[set maximum size of read requests]:size'
+  'hard_remove[immediate removal (do not hide files)]'
+  'use_ino[let filesystem set inode numbers]'
+  'readdir_ino[try to fill in d_ino in readdir]'
+  'direct_io[use direct I/O]'
+  'kernel_cache[cache files in kernel]'
+  'umask[set file permissions]:permission mask (octal)'
+  'uid[set file owner]:user id:'
+  'gid[set file group]:group id:'
+  'entry_timeout[cache timeout for names]:timeout (s)'
+  'negative_timeout[cache timeout for deleted names]:timeout (s)'
+  'attr_timeout[cache timeout for attributes]:timeout (s)'
+)
+
+[[ -n $cvalsvar ]] && set -- "$@" ${(P)cvalsvar}
+
+if [[ $# -eq 0 ]]; then
+  set -- 'mount options' $fvals
+else
+  set -- "$@" $fvals
+fi
+
+if [[ -n $state ]]; then
+  stateset=$state
+  state=
+fi
+
+_values $opts "$@" && ret=0
+
+if [[ -n $state ]]; then
+  compstate[restore]=
+elif [[ -n $stateset ]]; then
+  state=$stateset
+else
+  unset state
+fi
+
+return $ret
diff --git a/Completion/Linux/Type/_wakeup_capable_devices b/Completion/Linux/Type/_wakeup_capable_devices
new file mode 100644
index 000000000..daad43b7a
--- /dev/null
+++ b/Completion/Linux/Type/_wakeup_capable_devices
@@ -0,0 +1,15 @@
+#autoload
+
+local ret=1 item devline expl
+typeset -a desc
+
+_call_program wakeup-capable-devices acpitool -w 2> /dev/null |
+while read devline; do
+  [[ -n ${devline:#(#b)([0-9]#).[[:space:]]#([^[:space:]]#)[[:space:]]#[0-9]#[[:space:]]#(*)} ]] && continue
+  zformat -f item "${match[1]}:%8d (currently ${match[3]})" d:${match[2]}
+  desc+=$item
+done
+
+_describe -t wakeup-capable-devices 'wakeup capable device' desc "$@" && ret=0
+
+return ret