[Bash-completion-devel] typo/enhancements for styleguide.txt

Raphaël Droz raphael.droz+floss at gmail.com
Sun Dec 4 18:49:33 UTC 2011


you may want to squash them (2/3 is useless).

[ I used gitorious as a way to backup code before I understood how bad
the idea was in respect to "git rebase" abilities ]


I need myself to dig the last question before adding some explanations:
COMPREPLY=( ... -- $cur ) or COMPREPLY=( ... -- "$cur" )


Raph
-------------- next part --------------
>From 235e6e6ee7f981c7a4dd0d96e4a009beb049b6d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20Droz?= <raphael.droz+floss at gmail.com>
Date: Thu, 18 Aug 2011 20:34:31 +0200
Subject: [PATCH 1/3] Typo in doc/styleguide.txt.

---
 doc/styleguide.txt |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/doc/styleguide.txt b/doc/styleguide.txt
index 76b616e..cffa715 100644
--- a/doc/styleguide.txt
+++ b/doc/styleguide.txt
@@ -26,7 +26,7 @@ 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 [ ]
+[[ ]] vs [ ]
 ----------------
 
 Use [[ ]] instead of [ ] when testing multiple conditions. [ ] is fine
-- 
1.7.8.rc3

-------------- next part --------------
>From 4c45374a0020ea9e796320716e1c5c712c8fa71e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20Droz?= <raphael.droz+floss at gmail.com>
Date: Sat, 22 Oct 2011 13:29:31 +0200
Subject: [PATCH 2/3] styleguide typo

---
 doc/styleguide.txt |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/doc/styleguide.txt b/doc/styleguide.txt
index cffa715..c97204c 100644
--- a/doc/styleguide.txt
+++ b/doc/styleguide.txt
@@ -80,3 +80,5 @@ variable and function naming
 ----------------------------
 
 /////////////////////////////////////////
+
+COMPREPLY=( ... -- $cur ) or "$cur"
-- 
1.7.8.rc3

-------------- next part --------------
>From 70a2b1b5a4663f58b2464506c9b5b779ee3ee69d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20Droz?= <raphael.droz+floss at gmail.com>
Date: Sun, 4 Dec 2011 18:35:41 +0100
Subject: [PATCH 3/3] added a word about compopt -o nospace in styleguide.txt

---
 doc/styleguide.txt |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/doc/styleguide.txt b/doc/styleguide.txt
index 31a5b47..6afb4d2 100644
--- a/doc/styleguide.txt
+++ b/doc/styleguide.txt
@@ -75,5 +75,20 @@ variable and function naming
 ----------------------------
 
 /////////////////////////////////////////
-
-COMPREPLY=( ... -- $cur ) or "$cur"
+[[ $COMPREPLY == *= ]] && compopt -o nospace
+--------------------------------------------
+
+The above is a shorthand for:
+if [[ ${#COMPREPLY[@]} -eq 1 &&	\
+      $(grep -o '.$' <<<"${COMPREPLY[0]}") = '=' ]]; then
+	compopt -o nospace
+fi
+
+It is used to ensure that long options's name won't get a space
+appended after the 'equal' sign.
+Calling compopt -o nospace makes sense in case a completion
+actually occurs: when only 1 (one) completion is available in
+COMPREPLY.
+
+COMPREPLY=( ... -- $cur ) or COMPREPLY=( ... -- "$cur" ) ?
+----------------------------------------------------------
-- 
1.7.8.rc3



More information about the Bash-completion-devel mailing list