joshmedeski / t-smart-tmux-session-manager

t - the smart tmux session manager
326 stars 51 forks source link

Crashes if no FZF_TMUX_OPTS set #82

Closed lukeberry99 closed 10 months ago

lukeberry99 commented 11 months ago

If there are no FZF_TMUX_OPTS set then t crashes with the following output

[...]/bin/t: line 142: conditional binary operator expected
[...]/bin/t: line 142: syntax error near `$FZF_TMUX_OPTS'
[...]/bin/t: line 142: `                if [[ ! -v $FZF_TMUX_OPTS ]]; then'

Don't we want to be setting -z to check if FZF_TMUX_OPTS is unset, and if it is we give it a default value? Whereas right now we're checking if it is set, and then overwriting it if it is?

Happy to make a PR to this effect

RayJameson commented 11 months ago

+1 on this one, it seems like -v doesn't work correctly, check screenshot. It doesn't crash in my case, however I can't set colorscheme using this variable, but if I change -v to -z in the t script file it does work as intended

image
RayJameson commented 11 months ago

After update it's working even with -v, I don't understand why, considering testing with echo, but at least I can set up my colorscheme

joshmedeski commented 11 months ago

It's stating a "syntax error". What version of bash is on your machine? (bash --version).

I require bash >= 4.0 for this project to properly work.

lukeberry99 commented 11 months ago

I was running 3.2 - but I've upgraded to 5.2.21 and it does fix it.

For what it's worth, I do have a branch that gets this working for me in bash 3.x - https://github.com/lukeberry99/t-smart-tmux-session-manager/tree/fix/fzf-tmux-opts

But unsure if that's warranted, I missed the min bash version on the README and it works as expected if you're using the correct setup 😂

joshmedeski commented 10 months ago

I think it's a good idea to update the switch case. I will make a quick commit this week.

joshmedeski commented 10 months ago

Check out the latest release, I downgraded the script to bash v3: https://github.com/joshmedeski/t-smart-tmux-session-manager/releases/tag/v2.7.0