andresgongora / synth-shell-prompt

Customize your terminal with colors, extra system information, and eyecandy
GNU General Public License v3.0
37 stars 19 forks source link

ZSH error #18

Open ThatOneOcto opened 2 years ago

ThatOneOcto commented 2 years ago

Describe the bug When opening ZSH, I get this error

/home/adrian/.config/synth-shell/synth-shell-prompt.sh:type:561: bad option: -t
/home/adrian/.config/synth-shell/synth-shell-prompt.sh:831: = not found

It doesn't show up in bash no error

To Reproduce Steps to reproduce the behavior: I haven't a clue

Expected behavior For the synth shell prompt to work

andresgongora commented 2 years ago

Hi ThatOneOcto. ZSH is not fully supported at this time, mostly because there is no developer in the team working on it. I guess the errors you are seeing are because of non-compabilities between Bash and ZSH.

The error lines that are mentioned in the output are from the assembled script. You can open it up and find those lines, then identify them in the source script (which has comments and is easy to read). Would you mind testing/checking what the -t option is needed for and whether there is an alternative for ZSH? With some luck, the fix is super easy.

Cheers

andresgongora commented 2 years ago

It seems there was the exact same issue with #15 , but it was not addressed. Let's see if we can pinpoint the issue this time ;)

ThatOneOcto commented 2 years ago

Okay, I was thinking that but I just didn't I forgot why

ThatOneOcto commented 2 years ago

I found the line with the issue

[ "$(type -t include)" != 'function' ]&&{ include(){ { [ -z "$_IR" ]&&_IR="$PWD"&&cd "$(dirname "${BASH_SOURCE[0]}")"&&include "$1"&&cd "$_IR"&&unset _IR;}||{ local d="$PWD"&&cd "$(dirname "$PWD/$1")"&&. "$(basename "$1")"&&cd "$d";}||{ echo "Include failed $PWD->$1"&&exit 1;};};}
synth_shell_prompt()

I'll show you line 831 next

ThatOneOcto commented 2 years ago

Here is line 831

if [ "${BASH_SOURCE[0]}" == "${0}" ]; then
        echo -e "Do not run this script, it will do nothing.\nPlease source it instead by running:\n"
        echo -e "\t. ${BASH_SOURCE[0]}\n"
    elif [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
        synth_shell_prompt
    fi
andresgongora commented 2 years ago

That's interesting! It seems to be caused (likely) by BASH_SOURCE[0]. If you run echo $BASH_SOURCE[0] in your terminal, what do you get? I suspect these lines, in the script, were not expecting to receive an empty line or whatever output zsh throws. The fix shouldn't be too hard

ThatOneOcto commented 2 years ago

When I run the command, I am returned with nothing

https://i.imgur.com/JEOtaU7.png