about summary refs log tree commit diff
path: root/Etc
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 /Etc
parent92b0e885d6273315602668eb50f25310020fee13 (diff)
downloadzsh-4d19645d49b145a34bcb36eeb3b70ef089c55ba9.tar.gz
zsh-4d19645d49b145a34bcb36eeb3b70ef089c55ba9.tar.xz
zsh-4d19645d49b145a34bcb36eeb3b70ef089c55ba9.zip
43031: Add note to style guide about variant syntax
Diffstat (limited to 'Etc')
-rw-r--r--Etc/completion-style-guide20
1 files changed, 20 insertions, 0 deletions
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