fix(tmux-sessionizer): unbound variable bug

This commit is contained in:
Moritz Böhme 2023-04-26 11:43:34 +02:00
parent 0b7e18a3f5
commit 202f7e4558

View file

@ -13,15 +13,15 @@ let
options=$(fd -HIg '.git' ~/ --min-depth 1 --max-depth 5 --type d --prune --exec dirname {} | fzf --filter "''$*") options=$(fd -HIg '.git' ~/ --min-depth 1 --max-depth 5 --type d --prune --exec dirname {} | fzf --filter "''$*")
if [[ -z $options ]]; then if [[ -z $options ]]; then
return 1 exit 1
elif [[ $(wc -l <<< "$options") -eq 1 ]]; then elif [[ $(wc -l <<< "$options") -eq 1 ]]; then
selected="$options" selected="$options"
else else
echo "$options" | fzf --query="$*" selected=$(echo "$options" | fzf --query="$*")
fi fi
if [[ -z $selected ]]; then if [[ -z $selected ]]; then
exit 0 exit 0
fi fi
selected_name=$(basename "$selected" | tr . _) selected_name=$(basename "$selected" | tr . _)