Open jiengup opened 11 months ago
@jiengup I'm not sure what is the question here.
You can either rewrite the plugin to generate a zsh compatable script, or switch execution in SwiftBar from zsh to bash.
@jiengup I'm not sure what is the question here.
You can either rewrite the plugin to generate a zsh compatable script, or switch execution in SwiftBar from zsh to bash.
I think it may be that swiftbar's string parser does something like "add quotas between some specific string"? Cause when I choice "run in terminal" and get something like
--⬆️ Upgrade All (26) | terminal="true" refresh="true" bash="/opt/homebrew/bin/brew" param1="upgrade" param2="--formula" param3="c-ares" param4="cmake" param5="coreutils" param6="d2" param7="fd" param8="gawk" param9="gcc" param10="git-lfs" param11="go" param12="gperftools" param13="lf" param14="libpthread-stubs" param15="libssh" param16="lua" param17="mpfr" param18="node" param19="openssl@1.1" param20="python@3.11" param21="qemu" param22="smartmontools" param23="texinfo" param24="tree" param25="typst" param26="wimlib" param27="yarn" param28="&&" param29="/opt/homebrew/bin/brew" param30="upgrade" param31="--cask" param32="ipatool"
Please notice param28
above
But when I click this ⬆️ Upgrade All (26)
in menubar, the terminal will run:
/opt/homebrew/bin/brew upgrade --formula c-ares cmake coreutils d2 fd
gawk gcc git-lfs go gperftools lf libpthread-stubs libssh lua mpfr node openssl@
1.1 python@3.11 qemu smartmontools texinfo tree typst wimlib yarn '&&' /opt/homebrew/bin/brew upgrade --cask ipatool
Plese notice '&&'
above, other params can be parsed without '
, which work perfectly.
And the shell will not recognize this expression and take '&&'
as some kind of parameters then fail to run.
Please tell me if I'm mistaken on this issue and if it's because of some features of zsh or ruby language.
Ah, got it. Sorry, early morning comment:)
Yeah, you're right, this is might be quating\escaping I've added in the latest release, let me look into it.
@jiengup can you check if beta build fixes this?
@melonamin Yep, I just install beta build and test it. It works perfectly. Nice job! I'll keep using this beta version and give feedback. Thank you for getting back to me.
@melonamin Sorry, I found it will not work perfectly when I write in python like
bash="/usr/bin/vim", param1="~/.vimrc"
Swiftbar will produce output /usr/bin/vim "~/.vimrc"
and vim will take it as a directory instead of a normal file.
I think it's related to this issue.
I came here after digging around with the same issue, formerly-working &&
in params
now not working in 2.0. Using the beta build fixes it for me, too.
As in https://github.com/matryer/xbar-plugins/blob/main/Dev/Homebrew/brew-updates.1h.rb#L306 if writing in ruby like:
then the shell will run like this:
however zsh can not accept '&&' as && or ';' as ; and raise an error.