zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] Completion Enhancement for Linux NetworkManager
@ 2018-06-13 14:31 David Klann
  0 siblings, 0 replies; only message in thread
From: David Klann @ 2018-06-13 14:31 UTC (permalink / raw)
  To: zsh-workers


[-- 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 --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-06-13 14:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-13 14:31 [PATCH] Completion Enhancement for Linux NetworkManager David Klann

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).