[Bash-completion-devel] typo/enhancements for styleguide.txt
Raphaël
raphael.droz at gmail.com
Sun Dec 11 18:35:01 UTC 2011
this attempts to explain why $split && return
-------------- next part --------------
diff --git a/doc/styleguide.txt b/doc/styleguide.txt
index 3391970..85e6d6b 100644
--- a/doc/styleguide.txt
+++ b/doc/styleguide.txt
@@ -106,3 +106,14 @@ COMPREPLY.
COMPREPLY=( ... -- $cur ) or COMPREPLY=( ... -- "$cur" ) ?
----------------------------------------------------------
+
+$split && return
+----------------
+Should be used in completions using the -s flag of _init_completion,
+after $prev has been managed but before $cur is considered.
+Rationale: -s flag calls _split_longopt() which attempt to split $cur.
+$split = 0 means:
+- $cur was actually split (during _init_completion())
+- _split_longopt() actually split $cur into $prev=--* and $cur=<something>
+- the value of $cur within the completion is rather non-significant outside
+the context of $prev.
More information about the Bash-completion-devel
mailing list