.local-bin/wzp

25 lines
688 B
Bash
Executable file

#!/usr/bin/env bash
# Wezterm Project - Start a new wezterm project
PROJECTS_DIR="$HOME/.config/wezterm/projects"
project=""
if [[ -z "$1" ]]; then
# List all files in projects directory. Only keep the file name without the extension
project=$(fd -d 1 -e lua -t f -t l . ~/.config/wezterm/projects --print0 | xargs -0 -n 1 basename | sed 's/\.lua$//' | fzf --cycle --layout=reverse)
else
if [[ ! -e "$PROJECTS_DIR/$1.lua" ]]; then
echo "The project file '$PROJECTS_DIR/$1.lua' not exists"
exit 1
fi
project="$1"
fi
if [[ -z $project ]]; then
echo "No project selected"
exit 1
fi
WZ_PROJECT="$project" wezterm start --always-new-process &