[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 08c51bccbd367c63373d60a063f8768de4fdb8a6

Ville Skyttä ville.skytta at iki.fi
Fri Nov 20 20:55:05 UTC 2009


The following commit has been merged in the master branch:
commit 08c51bccbd367c63373d60a063f8768de4fdb8a6
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Fri Nov 20 22:54:44 2009 +0200

    Add style guide items for case label globbing and [[ ]] vs [ ].

diff --git a/doc/styleguide.txt b/doc/styleguide.txt
index 12efec3..69209c3 100644
--- a/doc/styleguide.txt
+++ b/doc/styleguide.txt
@@ -11,17 +11,29 @@ Indentation
 -----------
 Indent step should be 4 spaces, no tabs.
 
+Globbing in case labels
+-----------------------
+
+Avoid "fancy" globbing in case labels, just use traditional style when
+possible.  For example, do "--foo|--bar)" instead of "--@(foo|bar))".
+Rationale: the former is easier to read, often easier to grep, and
+doesn't confuse editors as bad as the latter, and is concise enough.
+
+[[ ]] vs [ ]
+------------
+
+Use [[ ]] instead of [ ] when testing multiple conditions. [ ] is fine
+for single conditions where the syntax works.  Rationale: [[ ]] has
+short circuit behavior within one test containing multiple conditions
+separated by && or ||, while [ ] with -a or -o does not.  Thus it can
+be more efficient in some cases and may reduce need for nesting
+conditions, and it's cleaner to write for example [[ ... && ... ]]
+than [ ... ] && [ ... ], and in general [[ ]] has more features.
+
 /////////////////////////////////////////
 case/esac vs if
 ---------------
 
-simple matching vs extended globbing
-------------------------------------
-in case statements: -@(a|b)) vs -a|-b)
-
-testing with [[ ]] vs [ ]
--------------------------
-
 line wrapping
 -------------
 

-- 
bash-completion



More information about the Bash-completion-commits mailing list