about summary refs log tree commit diff
path: root/Completion/Linux
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2011-01-09 16:57:01 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2011-01-09 16:57:01 +0000
commite72999c092b80b71c5913a52c411a1c7529971f4 (patch)
tree02974c6a4f7a4d73934481f731f12703a682fae7 /Completion/Linux
parenta89f0559c210def9a40bfeb9da6b38128a49cb55 (diff)
downloadzsh-e72999c092b80b71c5913a52c411a1c7529971f4.tar.gz
zsh-e72999c092b80b71c5913a52c411a1c7529971f4.tar.xz
zsh-e72999c092b80b71c5913a52c411a1c7529971f4.zip
gi1242+zsh@gmail.com: 28594:
Various new and improved completions
Diffstat (limited to 'Completion/Linux')
-rw-r--r--Completion/Linux/Command/.distfiles1
-rw-r--r--Completion/Linux/Command/_modutils24
-rw-r--r--Completion/Linux/Command/_wpa_cli13
3 files changed, 37 insertions, 1 deletions
diff --git a/Completion/Linux/Command/.distfiles b/Completion/Linux/Command/.distfiles
index 3c3103e22..251204e3b 100644
--- a/Completion/Linux/Command/.distfiles
+++ b/Completion/Linux/Command/.distfiles
@@ -27,5 +27,6 @@ _tune2fs
 _uml
 _valgrind
 _vserver
+_wpa_cli
 _yast
 '
diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils
index 3ae76fec9..b3f8fcd46 100644
--- a/Completion/Linux/Command/_modutils
+++ b/Completion/Linux/Command/_modutils
@@ -1,8 +1,23 @@
 #compdef lsmod modinfo modprobe rmmod insmod
 
+_modules_caching_policy()
+{
+  # Rebuild every week, or if $modules_dir is newer than the cache
+  local -a oldp
+
+  oldp=( "$1"(Nmw+1) )
+  (( $#oldp )) || [[ $modules_dir -nt $1 ]]
+}
+
 local curcontext="$curcontext" expl state line modules ign args ret=1
 local -r modules_dir=/lib/modules
 
+local update_policy
+zstyle -s ":completion:*:*:$service:*" cache-policy update_policy
+if [[ -z "$update_policy" ]]; then
+  zstyle ":completion:*:*:$service:*" cache-policy _modules_caching_policy
+fi
+
 args=(
   '(-)'{-V,--version}'[print version]'
   '(-)'{-h,--help}'[print help text]'
@@ -39,6 +54,7 @@ case "$service" in
       "(-v --verbose $ign)"{-v,--verbose}'[print all commands as executed]' \
       '(-C --config)'{-C,--config}'[specify config file]:config file:_files' \
       "(-r --remove -l --list -t --type -a --all $ign)"{-r,--remove}'[remove module (stacks)]' \
+      "(-l --list -t --type -a --all $ign)"{'-i[ignore install/remove commands in config file]','--ignore-install[ignore install commands in config file]','--ignore-remove[ignore remove commands in config file]'} \
       "(* -l --list -r --remove $ign)"{-l,--list}'[list matching modules]' \
       "(-c $ign)1:modules:->loadable_modules" \
       "(-c -l --list -t --type $ign)*:params:->params" && ret=0
@@ -87,7 +103,13 @@ case "$state" in
     else
       kver=$(uname -r)
     fi
-    modules=( $modules_dir/$kver/(*~(source|build))/**/*(.:t:r) )
+    if [[ -z $modules ]] && ! _cache_invalid modules-$kver && \
+      ! _retrieve_cache modules-$kver;
+    then 
+      # 2011-01-02 gi1242: Do we need .o files? Or is .ko enough?
+      modules=( $modules_dir/$kver/(*~(source|build))/**/*.(o|ko)(.:t:r) )
+      _store_cache modules-$kver modules
+    fi
 
     if [[ $state = loadable_modules ]]; then
         modules=( ${modules:#(${(j:|:)~${=loaded_modules//_/-}})} )
diff --git a/Completion/Linux/Command/_wpa_cli b/Completion/Linux/Command/_wpa_cli
new file mode 100644
index 000000000..e1342ca80
--- /dev/null
+++ b/Completion/Linux/Command/_wpa_cli
@@ -0,0 +1,13 @@
+#compdef wpa_cli
+
+_arguments \
+    '-p:path to ctrl sockets:_files -g "*(=)"' \
+    '-i:ifname:_net_interfaces' \
+    '-h[help]' \
+    '-v[shown version information]' \
+    '-B[run a daemon in the background]' \
+    '-a[run in daemon mode]:action file:_files' \
+    '-P:pid file:_files' \
+    '-g:global ctrl:_files -g "*(=)"' \
+    '-G:ping interval:' \
+    ':command:(status ping mib help interface level license quit set logon logoff pmksa reassociate preauthenticate identity password new_password pin otp passphrase bssid list_networks select_network enable_network disable_network add_network remove_network set_network get_network save_config disconnect reconnect scan scan_results bss get_capability reconfigure terminate interface_add interface_remove interface_list ap_scan stkstart ft_ds wps_pbc wps_pin wps_reg)'