about summary refs log tree commit diff
diff options
context:
space:
mode:
authordana <dana@dana.is>2018-06-16 11:49:20 -0500
committerdana <dana@dana.is>2018-06-16 11:49:20 -0500
commit4d19645d49b145a34bcb36eeb3b70ef089c55ba9 (patch)
tree2c1bfce92e134cba8aafaecd6607ca77c2f3bcc6
parent92b0e885d6273315602668eb50f25310020fee13 (diff)
downloadzsh-4d19645d49b145a34bcb36eeb3b70ef089c55ba9.tar.gz
zsh-4d19645d49b145a34bcb36eeb3b70ef089c55ba9.tar.xz
zsh-4d19645d49b145a34bcb36eeb3b70ef089c55ba9.zip
43031: Add note to style guide about variant syntax
-rw-r--r--ChangeLog5
-rw-r--r--Etc/completion-style-guide20
2 files changed, 25 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index f05bb1240..f5e36572a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-06-16  dana  <dana@dana.is>
+
+	* 43031: Etc/completion-style-guide: Add note about optional/variant
+	syntax (cf. 43025)
+
 2018-06-15  dana  <dana@dana.is>
 
 	* 43024: Completion/Unix/Command/_man: Improve section-name matching
diff --git a/Etc/completion-style-guide b/Etc/completion-style-guide
index a6fc737a7..ca99c828b 100644
--- a/Etc/completion-style-guide
+++ b/Etc/completion-style-guide
@@ -20,6 +20,26 @@ Coding style:
 * Please try not to use lines longer than 79 characters. Don't worry
   about breaking long `_arguments' or `_values' specs though.
 
+* Never use alternative, unusual, or optional syntax in completion
+  functions (or any other shell code distributed with zsh). In other
+  words, do NOT use the following:
+
+    # Short loops
+    for x in $y; myfunc $x
+
+    # Alternative forms
+    if { [[ $x == $y ]] } {
+      myfunc $x
+    }
+    foreach x in $y {
+      myfunc $x
+    }
+
+    # Weird tricks
+    () for 1 {
+      myfunc $1
+    } $x
+
 Descriptions:
 
 Descriptions should not have a trailing full stop and initial capital