#!/usr/bin/env fish
mise env -s fish | source

set -l g (set_color a6d189)
set -l b (set_color 8caaee)
set -l s '#8caaee'
set -l n (set_color normal)

gum style --foreground "$s" --border double --padding "1 2" --margin "1" "mise env — variables d'environnement"
gum spin --spinner.foreground "$s" --spinner dot --title " " -- fish -c read

echo "$g❯$b cat mise.toml$n"
cat mise.toml
gum spin --spinner.foreground "$s" --spinner dot --title " " -- fish -c read

echo
echo "$g❯$b echo \$APP_ENV$n"
echo $APP_ENV
gum spin --spinner.foreground "$s" --spinner dot --title " " -- fish -c read

echo
echo "$g❯$b env$n"
mise env | grep APP
gum spin --spinner.foreground "$s" --spinner dot --title " " -- fish -c read

echo
set env_choice (gum choose "development" "staging" "production" --header "Choisir l'environnement :"); or exit 0

echo "$g❯$b mise set APP_ENV=$env_choice$n"
mise config set env.APP_ENV $env_choice
mise env -s fish | source
gum spin --spinner.foreground "$s" --spinner dot --title " " -- fish -c read

echo
echo "$g❯$b cat mise.toml$n"
cat mise.toml
gum spin --spinner.foreground "$s" --spinner dot --title " " -- fish -c read

echo
echo "$g❯$b echo \$APP_ENV$n"
echo $APP_ENV
