zsh-workers
 help / color / mirror / code / Atom feed
From: David Klann <dklann@linux.com>
To: zsh-workers@zsh.org
Subject: [PATCH] Completion Enhancement for Linux NetworkManager
Date: Wed, 13 Jun 2018 09:31:21 -0500	[thread overview]
Message-ID: <3672c5e0-9b01-2c9c-c1e5-fe36f4031c31@linux.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1082 bytes --]

Hi,

Here is a small patch for nmcli(1) on Linux. This is my first patch
submission. Please let me know if there is a better way to implement
this. It completes only "active" connections for the "nmcli connection
down" subcommand.

Thanks!

  ~David Klann

diff --git a/Completion/Linux/Command/_networkmanager
b/Completion/Linux/Command/_networkmanager
index 881445abb..e38215e76 100644
--- a/Completion/Linux/Command/_networkmanager
+++ b/Completion/Linux/Command/_networkmanager
@@ -102,7 +102,7 @@ _nm_connection_up() {
 }
 
 _nm_connection_down() {
-  _arguments "1:connection:_nm_connection_specs"
+  _arguments "1:connection:_nm_connection_active"
 }
 
 _nm_connection_modify() {
@@ -162,6 +162,12 @@ _nm_connection_ids() {
   _describe 'select connection' con_ids
 }
 
+_nm_connection_active() {
+  local -a con_ids
+  con_ids=(${(f)"$(_call_program nmcli nmcli -t -f name connection show
--active)"})
+  _describe 'select connection' con_ids
+}
+
 _nm_device() {
   local curcontext="$curcontext" state line
 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 293 bytes --]

                 reply	other threads:[~2018-06-13 14:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=3672c5e0-9b01-2c9c-c1e5-fe36f4031c31@linux.com \
    --to=dklann@linux.com \
    --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).