zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <opk@zsh.org>
To: Zsh workers <zsh-workers@zsh.org>
Subject: PATCH: lsns completion
Date: Wed, 20 Oct 2021 20:48:53 +0200	[thread overview]
Message-ID: <298-1634755733.362351@8oWD.3ryx.YSGy> (raw)

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'


             reply	other threads:[~2021-10-20 18:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-20 18:48 Oliver Kiddle [this message]
2021-10-21 14:27 ` Daniel Shahaf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=298-1634755733.362351@8oWD.3ryx.YSGy \
    --to=opk@zsh.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).