[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.90-86-g4fa2616

Ville Skyttä ville.skytta at iki.fi
Sun Dec 11 20:23:18 UTC 2011


The following commit has been merged in the master branch:
commit 4fa2616e70a4c0dda96aa995d96211261731a992
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sun Dec 11 22:23:06 2011 +0200

    Document $split && return.

diff --git a/doc/styleguide.txt b/doc/styleguide.txt
index 12b224f..31ad446 100644
--- a/doc/styleguide.txt
+++ b/doc/styleguide.txt
@@ -75,6 +75,26 @@ appended after the equal sign.  Calling compopt -o nospace makes sense
 in case completion actually occurs: when only one completion is
 available in COMPREPLY.
 
+$split && return
+----------------
+
+Should be used in completions using the -s flag of _init_completion,
+or other similar cases where _split_longopt has been invoked, after
+$prev has been managed but before $cur is considered.  If $cur of the
+form --foo=bar was split into $prev=--foo and $cur=bar and the $prev
+block did not process the option argument completion, it makes sense
+to return immediately after the $prev block because --foo obviously
+takes an argument and the remainder of the completion function is
+unlikely to provide meaningful results for the required argument.
+Think of this as a catch-all for unknown options requiring an
+argument.
+
+Note that even when using this, options that are known to require an
+argument but for which we don't have argument completion should be
+explicitly handled (non-completed) in the $prev handling block because
+--foo=bar options can often be written without the equals sign, and in
+that case the long option splitting does not occur.
+
 /////////////////////////////////////////
 case/esac vs if
 ---------------

-- 
bash-completion



More information about the Bash-completion-commits mailing list