about summary refs log tree commit diff
path: root/Completion/Linux/Command
diff options
context:
space:
mode:
authorOliver Kiddle <okiddle@yahoo.co.uk>2019-09-27 00:27:45 +0200
committerOliver Kiddle <okiddle@yahoo.co.uk>2019-09-27 00:27:45 +0200
commit4f48ce208b89b0790f113642aab200a65abf7816 (patch)
tree077ab574515a61bc05c3e7f38a7493678f52a1f3 /Completion/Linux/Command
parent81be5d1dceae907052858d3c2140a109d5c3f553 (diff)
downloadzsh-4f48ce208b89b0790f113642aab200a65abf7816.tar.gz
zsh-4f48ce208b89b0790f113642aab200a65abf7816.tar.xz
zsh-4f48ce208b89b0790f113642aab200a65abf7816.zip
44781: add completion of SELinux contexts
Diffstat (limited to 'Completion/Linux/Command')
-rw-r--r--Completion/Linux/Command/_chcon24
1 files changed, 24 insertions, 0 deletions
diff --git a/Completion/Linux/Command/_chcon b/Completion/Linux/Command/_chcon
new file mode 100644
index 000000000..2d523f287
--- /dev/null
+++ b/Completion/Linux/Command/_chcon
@@ -0,0 +1,24 @@
+#compdef chcon
+
+local ign
+
+(( $#words > 2 )) && ign='!'
+_arguments -C -s -S \
+  '(-h --no-dereference)--dereference[dereference symlinks]' \
+  '(-h --no-dereference --dereference)'{-h,--no-dereference}'[operate on symlinks themselves]' \
+  '(1 -u --user -r --role  -l --range -t --type)--reference=[copy security context of specified file]:file:_files' \
+  '(1 --reference -u --user)'{-u+,--user=}'[set user in the target security context]: :_selinux_users' \
+  '(1 --reference -r --role)'{-r+,--role=}'[set role in the target security context]: :_selinux_roles' \
+  '(1 --reference -t --type)'{-t+,--type=}'[set type in the target security context]: :_selinux_types' \
+  '(1 --reference -l --range)'{-l+,--range=}'[set range in the target security context]:selinux range' \
+  '(--recursive -R)'{--recursive,-R}'[recurse subdirectories]' \
+  '(-v --verbose)'{-v,--verbose}'[output a diagnostic for every file processed]' \
+  '(-H -L -P)-H[follow symlinks on the command line]' \
+  '(-H -L -P)-L[follow all symlinks]' \
+  "(-H -L -P)-P[don't follow symlinks (default)]" \
+  '!(--preserve-root)--no-preserve-root' \
+  "--preserve-root[fail to operate recursively on '/']" \
+  '(--reference -u --user -r --role  -l --range -t --type)1:security context:_selinux_contexts' \
+  "${ign}--help[display help information]" \
+  "${ign}--version[display version information]" \
+  '*:file:_files'