about summary refs log tree commit diff
path: root/Completion/Linux
diff options
context:
space:
mode:
authordana <dana@dana.is>2018-01-05 14:26:17 -0600
committerOliver Kiddle <opk@zsh.org>2018-01-06 00:13:51 +0100
commit0f0b602415961aa9ca069c9719a0fbb4bbb9941f (patch)
tree03001cfaf7ed12c26a354a996f52c4920d08cb76 /Completion/Linux
parent0c5f851021b3aacea96d9ca446282b8dab9f260d (diff)
downloadzsh-0f0b602415961aa9ca069c9719a0fbb4bbb9941f.tar.gz
zsh-0f0b602415961aa9ca069c9719a0fbb4bbb9941f.tar.xz
zsh-0f0b602415961aa9ca069c9719a0fbb4bbb9941f.zip
42231: new completion functions for simple utilities belonging to the 'Darwin' and 'Linux' groups.
Diffstat (limited to 'Completion/Linux')
-rw-r--r--Completion/Linux/Command/_chattr42
-rw-r--r--Completion/Linux/Command/_ldconfig35
-rw-r--r--Completion/Linux/Command/_lsattr11
3 files changed, 88 insertions, 0 deletions
diff --git a/Completion/Linux/Command/_chattr b/Completion/Linux/Command/_chattr
new file mode 100644
index 000000000..bf46d8b89
--- /dev/null
+++ b/Completion/Linux/Command/_chattr
@@ -0,0 +1,42 @@
+#compdef chattr
+
+local ret=1
+local -a context line state state_descr
+local -A opt_args val_args
+
+_arguments -s -S : \
+  '-f[suppress most error messages]' \
+  "-p+[set file's project number]:project number" \
+  '-R[act recursively]' \
+  '-V[output verbosely]' \
+  "-v+[set file's version/generation number]:version/generation number" \
+  '1: :->attrs' \
+  '*: :_files' \
+&& ret=0
+
+[[ $state == attrs ]] &&
+if compset -P '*[=+-]'; then
+  # These modes can't be changed with chattr: [EhINXZ]
+  _values -S '' attribute \
+    'A[no atime updates]' \
+    'a[append only]' \
+    'C[no copy on write]' \
+    'c[compressed]' \
+    'D[no synchronous directory updates]' \
+    'd[no dump]' \
+    'e[extent format]' \
+    'i[immutable]' \
+    'j[data journalling]' \
+    'P[project hierarchy]' \
+    'S[synchronous updates]' \
+    's[secure deletion]' \
+    'T[top of directory hierarchy]' \
+    't[no tail-merging]' \
+    'u[undeletable]' \
+  && ret=0
+else
+  compset -P '*'
+  _values -S '' operator = + - && ret=0
+fi
+
+return ret
diff --git a/Completion/Linux/Command/_ldconfig b/Completion/Linux/Command/_ldconfig
new file mode 100644
index 000000000..5f4802f91
--- /dev/null
+++ b/Completion/Linux/Command/_ldconfig
@@ -0,0 +1,35 @@
+#compdef ldconfig ldconfig.real
+
+local ret=1
+local -a context line state state_descr
+local -A opt_args
+
+_arguments -s -S : \
+  '(x -v --verbose)'{-v,--verbose}'[output verbosely]' \
+  '(x)*: :->files' \
+  + x \
+  '(: -)'{-\?,--help}'[display help information]' \
+  '(: -)'{-p,--print-cache}'[display libraries in current cache]' \
+  '(: -)--usage[display brief usage information]' \
+  '(: -)'{-V,--version}'[display version information]' \
+  + l \
+  '(x o)-l[manually link individual libraries (library mode)]' \
+  + o \
+  '(x l -c --format)'{-c+,--format=}'[specify cache format]:cache format:(old new compat)' \
+  '(x l)-C+[specify cache file to use instead of /etc/ld.so.cache]:cache file:_files' \
+  '(x l)-f+[specify configuration file to use instead of /etc/ld.so.conf]:configuration file:_files' \
+  '(x l -i --ignore-aux-cache)'{-i,--ignore-aux-cache}'[ignore auxiliary cache file]' \
+  '(x l -N)-n[process only directories specified on command line (implies -N)]' \
+  '(x l)-N[do not rebuild cache]' \
+  '(x l)-r+[specify root directory]:root directory:_directories' \
+  '(x l)-X[do not update symbolic links]' \
+&& ret=0
+
+[[ $state == files ]] &&
+if [[ -n ${opt_args[(I)l--l]} ]]; then
+  _object_files && ret=0
+else
+  _directories && ret=0
+fi
+
+return ret
diff --git a/Completion/Linux/Command/_lsattr b/Completion/Linux/Command/_lsattr
new file mode 100644
index 000000000..def0bd3d9
--- /dev/null
+++ b/Completion/Linux/Command/_lsattr
@@ -0,0 +1,11 @@
+#compdef lsattr
+
+_arguments -s -S : \
+  '-a[show all files, including hidden ones]' \
+  '-d[list directory entries instead of contents]' \
+  '-l[use long option names]' \
+  "-p[show file's project number]" \
+  '-R[act recursively]' \
+  '-V[display version information]' \
+  "-v[show file's version/generation number]" \
+  '*: :_files'