about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2021-02-06 00:05:41 +0100
committerOliver Kiddle <opk@zsh.org>2021-02-06 00:05:48 +0100
commitba48357315b3ceadee352e3c97ccac6a47e46ef4 (patch)
tree7907e9f6e50a5f92914d60f380ece56cefeea5ff /Completion
parentb8ec0ddba56768e0afff45ffe78bf51ecf60aaa4 (diff)
downloadzsh-ba48357315b3ceadee352e3c97ccac6a47e46ef4.tar.gz
zsh-ba48357315b3ceadee352e3c97ccac6a47e46ef4.tar.xz
zsh-ba48357315b3ceadee352e3c97ccac6a47e46ef4.zip
47918: new util-linux completions for nsenter and unshare
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Linux/Command/_nsenter28
-rw-r--r--Completion/Linux/Command/_unshare40
2 files changed, 68 insertions, 0 deletions
diff --git a/Completion/Linux/Command/_nsenter b/Completion/Linux/Command/_nsenter
new file mode 100644
index 000000000..8e7c6bc42
--- /dev/null
+++ b/Completion/Linux/Command/_nsenter
@@ -0,0 +1,28 @@
+#compdef nsenter
+
+local ign
+(( $#words > 2 )) && ign='!'
+
+_arguments -S -s \
+  '(-a --all)'{-a,--all}'[enter all namespaces]' \
+  '(-t --target)'{-t+,--target=}'[specify target process to get namespaces from]:pid:_pids' \
+  '(-m --mount)'{-m-,--mount=-}'[enter mount namespace]::file:_files' \
+  '(-u --uts)'{-u-,--uts=-}'[enter UTS namespace (hostname etc)]::file:_files' \
+  '(-i --ipc)'{-i-,--ipc=-}'[enter System V IPC namespace]::file:_files' \
+  '(-n --net)'{-n-,--net=-}'[enter network namespace]::file:_files' \
+  '(-p --pid)'{-p-,--pid=-}'[enter pid namespace]::file:_files' \
+  '(-C --cgroup)'{-C-,--cgroup=-}'[enter cgroup namespace]::file:_files' \
+  '(-U --user)'{-U-,--user=-}'[enter user namespace]::file:_files' \
+  '(-T --time)'{-T-,--time=-}'[enter time namespace]::file:_files' \
+  '(-S --setuid)'{-S+,--setuid=}'[set uid in entered namespace]:uid [0]' \
+  '(-G --setgid)'{-G+,--setgid=}'[set gid in entered namespace]:gid [0]' \
+  "--preserve-credentials[don't touch uids or gids]" \
+  '(-r --root)'{-r+,--root=}'[set the root directory]:directory:_directories' \
+  '(-w --wd)'{-w+,--wd=}'[set the working directory]:directory:_directories' \
+  '(-F --no-fork)'{-F,--no-fork}"[don't fork]" \
+  '(-Z --follow-context)'{-Z,--follow-context}'[set SELinux context according to --target PID]' \
+  "${ign}(- 1 *)"{-h,--help}'[display usage information]' \
+  "${ign}(- 1 *)"{-V,--version}'[display version information]' \
+  '1: : _command_names -e' \
+  '*::args :_normal'
+
diff --git a/Completion/Linux/Command/_unshare b/Completion/Linux/Command/_unshare
new file mode 100644
index 000000000..ff6f7042f
--- /dev/null
+++ b/Completion/Linux/Command/_unshare
@@ -0,0 +1,40 @@
+#compdef unshare
+
+local ign
+(( $#words > 2 )) && ign='!'
+
+# a different unshare exists on some systems
+if [[ $OSTYPE != linux* ]]; then
+  _default
+  return
+fi
+
+_arguments -S -s \
+  '(-m --mount)'{-m-,--mount=-}'[enter mount namespace]::file:_files' \
+  '(-u --uts)'{-u-,--uts=-}'[enter UTS namespace (hostname etc)]::file:_files' \
+  '(-i --ipc)'{-i-,--ipc=-}'[enter System V IPC namespace]::file:_files' \
+  '(-n --net)'{-n-,--net=-}'[enter network namespace]::file:_files' \
+  '(-p --pid)'{-p-,--pid=-}'[enter pid namespace]::file:_files' \
+  '(-U --user)'{-U-,--user=-}'[enter user namespace]::file:_files' \
+  '(-C --cgroup)'{-C-,--cgroup=-}'[enter cgroup namespace]::file:_files' \
+  '(-T --time)'{-T-,--time=-}'[enter time namespace]::file:_files' \
+  '(-f --fork)'{-f,--fork}"[fork before launching]" \
+  '(-r --map-root-user)--map-user=[map current user to uid (implies --user)]:user:_users' \
+  '--map-group=[map current group to gid (implies --user)]:group:_groups' \
+  '(-r --map-root-user -c --map-current-user --map-user)'{-r,--map-root-user}'[map current user to root (implies --user)]' \
+  '(-c --map-current-user)'{-c,--map-current-user}'[map current user to itself (implies --user)]' \
+  '(-f --fork)--kill-child=-[when dying, kill the forked child (implies --fork)]::signal [KILL]:_signals' \
+  '--mount-proc=-[mount proc filesystem first (implies --mount)]::mount point [/proc]:_directories' \
+  '--propagation=[modify mount propagation in mount namespace]:propagation flag:(slave shared private unchanged)' \
+  '--setgroups=[control the setgroups syscall in user namespaces]:grant setgroups:(allow deny)' \
+  '--keep-caps[retain capabilities granted in user namespaces]' \
+  '(-R --root)'{-R+,--root=}'[set the root directory]:directory:_directories' \
+  '(-w --wd)'{-w+,--wd=}'[set the working directory]:directory:_directories' \
+  '(-S --setuid)'{-S+,--setuid=}'[set uid in entered namespace]:uid [0]' \
+  '(-G --setgid)'{-G+,--setgid=}'[set gid in entered namespace]:gid [0]' \
+  '--monotonic=[set clock monotonic offset in time namespaces]:offset (seconds)' \
+  '--boottime=[set clock boottime offset in time namespaces]:offset (seconds)' \
+  "${ign}(- 1 *)"{-h,--help}'[display usage information]' \
+  "${ign}(- 1 *)"{-V,--version}'[display version information]' \
+  '1: : _command_names -e' \
+  '*::args :_normal'