--init show zsh: parse error near `>&'
alps2006 opened this issue · comments
alps2006 commented
A strange problem on z.lua --init
z.lua$ eval "$(lua z.lua --init)"
# output error
zsh: parse error near `>&'
I found the error location at -h|--help) local arg_mode="-h" ;;
, and i resolved by escaping --help
, but why only --help?
M z.lua
@@ -2188,7 +2188,7 @@ _zlua() {
-s) local arg_strip="-s" ;;
-i) local arg_inter="-i" ;;
-I) local arg_inter="-I" ;;
- -h|--help) local arg_mode="-h" ;;
+ -h|\--help) local arg_mode="-h" ;;
--purge) local arg_mode="--purge" ;;
*) break ;;
esac
Linwei commented
which version of zsh are you using?
I haven't encountered this before in zsh.
alps2006 commented
Thanks for your reply, the detail is below.
~/Documents/markdown ❯ zsh --version
zsh 5.9 (x86_64-apple-darwin23.0.0)
~/Documents/markdown ❯ type -a zsh
zsh is /opt/local/bin/zsh
zsh is /bin/zsh
zsh is /opt/local/bin/zsh
zsh is /bin/zsh
zsh is /opt/local/bin/zsh
Linwei commented
I am not sure if there is some side effect (mostly in other shells) when changing --
to \--
.
so I made another revise, please try out the latest version:
alps2006 commented
I have found the reason why i cannot use --help
only, because there is a global alias that overrides --help entirely.
# bat to render --help
alias -g -- --help='--help 2>&1 | bat --language=help --style=plain'
thank you very much, i close it.