workspace manager: when adding same name ask to override

This commit is contained in:
Sagi Dayan 2022-01-23 10:52:04 +02:00
parent ba74923f3a
commit fe3b4dd7ee
Signed by: sagi
GPG key ID: FAB96BFC63B46458

View file

@ -14,6 +14,19 @@ if [ -z "$NAME" ]; then
exit 1
fi
# Check if workspace already exists
if [ $(cat $JSON_PATH | jq 'keys' | grep "${NAME}") ]; then
OVERRIDE=$(cat <<EOF | fzf --reverse --header "a Worspace with name '${NAME}' already exists. Override?"
No
Yes
EOF
)
if [[ "$OVERRIDE" == "No" ]]; then
echo Canceled
exit
fi
fi
CURRENT_DIR=$(pwd)
LAYOUT=$(cat <<EOF | fzf --reverse --header "Select a layout for ${NAME}"