shell-completions icon indicating copy to clipboard operation
shell-completions copied to clipboard

fix echo bug for mac

Open gertcuykens opened this issue 3 years ago • 3 comments

Mac wil trow error on /usr/bin/echo

gertcuykens avatar Nov 11 '22 01:11 gertcuykens

Using the builtin echo breaks this check for me locally. It'd probably be better to just find a better way to do the check.

Vexu avatar Nov 11 '22 14:11 Vexu

This patch seems to work for me but it's a bit a bit unreliable depending on how long zig build --help takes.

diff --git a/_zig b/_zig
index 5f8e500..72b2bbb 100644
--- a/_zig
+++ b/_zig
@@ -285,10 +285,10 @@ __zig_build() {
     fi
   done <<< $help
 
-  if [ -z "$(/usr/bin/echo $words[$CURRENT] | grep "^-")" ]; then
-    _describe 'step' steps
-  else
+  if [[ $words[$CURRENT] == -* ]]; then
     _arguments ${args[@]}
+  else
+    _describe 'step' steps
   fi
 }
 

Vexu avatar Nov 12 '22 19:11 Vexu

✅ : zig build<tab> image

🟥 : zig build<space><tab> image

inserts \ \ on tab completion

🟥 : zig build -<tab> image no tab completion

Note this is for both versions, i didn't test the first time

gertcuykens avatar Nov 13 '22 01:11 gertcuykens