about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-09-17 09:22:42 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-09-17 09:22:42 +0000
commit665b54c9e4f145c5fe2f448f96270669b40eb6cf (patch)
tree1d6d892cda5127a3aaace3a8e1e667f782642a3f
parent1f9bd5bcebff8f47fcc2397cd665d62765608968 (diff)
downloadzsh-665b54c9e4f145c5fe2f448f96270669b40eb6cf.tar.gz
zsh-665b54c9e4f145c5fe2f448f96270669b40eb6cf.tar.xz
zsh-665b54c9e4f145c5fe2f448f96270669b40eb6cf.zip
zsh-workers/7902
-rw-r--r--Completion/Base/_arguments4
-rw-r--r--Doc/Zsh/compsys.yo14
2 files changed, 17 insertions, 1 deletions
diff --git a/Completion/Base/_arguments b/Completion/Base/_arguments
index e8756ea14..7c9e72c1f 100644
--- a/Completion/Base/_arguments
+++ b/Completion/Base/_arguments
@@ -217,6 +217,10 @@ if [[ "$*" != "$_args_cache_descr" ]]; then
     if [[ "$1" = *\[*\](|:*) ]]; then
       descr="${${1#*\[}%%\]*}"
       1="${1/\[$descr\]}"
+    elif [[ -n "$compconfig[autodescribe_options]" &&
+            "$1" = [-+][^:]##:[^:]#[^\\]:[^:]# ]]; then
+      descr="${${(M)${1#*:}#*[^\\]:}[1,-2]}"
+      descr="${compconfig[autodescribe_options]//\\%d/$descr}"
     fi
 
     # Description for both the `-foo' and `+foo' form?
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 970b958a6..c54fdb46d 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -799,7 +799,12 @@ configuration key tt(describe_options) is used to decide if these
 explanation strings should be printed when options are listed. If it
 is set to a non-empty string and it doesn't contain the substring
 `tt(!)var(command)', where `var(command)' is the name of the command
-that is completed for, the descriptions will be shown.
+that is completed for, the descriptions will be shown. If no
+explanation string is given but the tt(autodescribe_options) key is
+set and only one argument is described for this var(opt-spec), the
+option will be described by the value of tt(autodescribe_options) with 
+any appearance of the sequence `tt(%d)' in it replaced by the
+description for the first argument.
 )
 enditem()
 
@@ -1166,6 +1171,13 @@ listed. If the value string contains substrings of the form
 `tt(!)var(command)', this will not be done for any of these
 var(command)s.
 )
+item(tt(autodescribe_options))(
+If set, this string will be used as the description for options which
+are not described by the completion function, but that have exactly
+one argument. The sequence `tt(%d)' in the value will be replaced by
+the description for this argument. Depending on personal preferences,
+it may be useful to set this key to something like `tt(specify: %d)'.
+)
 item(tt(describe_values))(
 Like tt(describe_options), but used when completing value lists.
 )