about summary refs log tree commit diff
path: root/Etc/completion-style-guide
diff options
context:
space:
mode:
Diffstat (limited to 'Etc/completion-style-guide')
-rw-r--r--Etc/completion-style-guide12
1 files changed, 12 insertions, 0 deletions
diff --git a/Etc/completion-style-guide b/Etc/completion-style-guide
index 62e6a2787..f7dcae230 100644
--- a/Etc/completion-style-guide
+++ b/Etc/completion-style-guide
@@ -75,6 +75,8 @@ but use:
 To indicate a default value, use square brackets:
   '--timeout[specify connection timeout]:timeout (ms) [5000]'
 These two conventions can be used together or individually as appropriate.
+Alternatively the `_numbers' function may be used:
+  '--timeout[specify connection timeout]: :_numbers -u ms -d 5000 timeout'
 
 Group descriptions should be singular because only one thing is being
 completed even though many may be listed. This applies even where you
@@ -570,3 +572,13 @@ Misc. remarks
       data derived from another command's output to the helper. Consider
       using some variation of the `q` expansion flag to deal with this:
       `_call_program vals $words[1] ${(q-)myfile}'
+10) If you are going to create a new completion function '_cmd' for a
+    command 'cmd', and if the 'cmd' supports the --help option, then you
+    may try
+      compdef _gnu_generic cmd
+      cmd -<TAB>
+    _gnu_generic may not work sufficiently well for 'cmd', but the specs
+    for _arguments generated from the help text are cached in a variable
+    '_args_cache_cmd', and you can save them in a file '_cmd' by
+      print -r -- ${(F)${(@qqq)_args_cache_cmd}} > _cmd
+    and use the file as a draft of the new completion function.