Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: lsns completion
- X-seq: zsh-workers 49500
- From: Oliver Kiddle <opk@xxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: PATCH: lsns completion
- Date: Wed, 20 Oct 2021 20:48:53 +0200
- Archived-at: <https://zsh.org/workers/49500>
- List-id: <zsh-workers.zsh.org>
This is a new completion for util-linux's lsns command.
We could call it to get namespaces to complete. But it is mostly useful
to specify them by pid with -p anyway and they are just big numbers.
Oliver
diff --git a/Completion/Linux/Command/_lsns b/Completion/Linux/Command/_lsns
new file mode 100644
index 000000000..994101d97
--- /dev/null
+++ b/Completion/Linux/Command/_lsns
@@ -0,0 +1,18 @@
+#compdef lsns
+
+local ign
+
+(( $#words > 2 )) && ign='!'
+_arguments -s -S \
+ '(-J --json)'{-J,--json}'[use JSON output format]' \
+ '(-l --list)'{-l,--list}'[use list format output]' \
+ '(-n --noheadings)'{-n,--noheadings}"[don't print headings]" \
+ '(-o --output)'{-o,--output}'[define which output columns to use]:column:_sequence compadd -M "m\:{a-z}={A-Z}" - NS TYPE PATH NPROCS PID PPID COMMAND UID USER NETNSID NSFS' \
+ '(-p --task)'{-p+,--task=}'[print process namespaces]:process id:_pids' \
+ '(-r --raw)'{-r,--raw}'[use the raw output format]' \
+ '(-u --notruncate)'{-u,--notruncate}"[don't truncate text in columns]" \
+ '(-W --nowrap)'{-W,--nowrap}"[don't use multi-line representation]" \
+ '(-t --type)'{-t+,--type=}'[filter by namespace type]:namespace type:(mnt net ipc user pid uts cgroup)' \
+ "$ign(- *)"{-h,--help}'[display usage information]' \
+ "$ign(- *)"{-V,--version}'[display version information]' \
+ '*: :_guard "^-*" namespace'
Messages sorted by:
Reverse Date,
Date,
Thread,
Author