Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] Completion Enhancement for Linux NetworkManager



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: signature.asc
Description: OpenPGP digital signature



Messages sorted by: Reverse Date, Date, Thread, Author