magic.sh
This file
The walk stopped after 200 commits: lines older than 6837ed2 point at it.
feat(deps): bump github.com/charmbracelet/bubbletea from 0.27.0 to 1.0.0 (#661)dependabot[bot]before adoption6837ed2
lines 1–45why, one step back1#!/bin/bash23# Always ask for permission!4echo "Do you want to see a magic trick?"56YES="Yes, please!"7NO="No, thank you!"89CHOICE=$(gum choose "$YES" "$NO")1011if [ "$CHOICE" != "$YES" ]; then12 echo "Alright, then. Have a nice day!"13 exit 114fi151617# Let the magic begin.18echo "Alright, then. Let's begin!"19gum style --foreground 212 "Pick a card, any card..."2021CARD=$(gum choose "Ace (A)" "Two (2)" "Three (3)" "Four (4)" "Five (5)" "Six (6)" "Seven (7)" "Eight (8)" "Nine (9)" "Ten (10)" "Jack (J)" "Queen (Q)" "King (K)")22SUIT=$(gum choose "Hearts (♥)" "Diamonds (♦)" "Clubs (♣)" "Spades (♠)")2324gum style --foreground 212 "You picked the $CARD of $SUIT."2526SHORT_CARD=$(echo $CARD | cut -d' ' -f2 | tr -d '()')27SHORT_SUIT=$(echo $SUIT | cut -d' ' -f2 | tr -d '()')2829TOP_LEFT=$(gum join --vertical "$SHORT_CARD" "$SHORT_SUIT")30BOTTOM_RIGHT=$(gum join --vertical "$SHORT_SUIT" "$SHORT_CARD")3132TOP_LEFT=$(gum style --width 10 --height 5 --align left "$TOP_LEFT")33BOTTOM_RIGHT=$(gum style --width 10 --align right "$BOTTOM_RIGHT")3435if [[ "$SHORT_SUIT" == "♥" || "$SHORT_SUIT" == "♦" ]]; then36 CARD_COLOR="1" # Red37else38 CARD_COLOR="7" # Black39fi4041gum style --border rounded --padding "0 1" --margin 2 --border-foreground "$CARD_COLOR" --foreground "$CARD_COLOR" "$(gum join --vertical "$TOP_LEFT" "$BOTTOM_RIGHT")"4243echo "Is this your card?"4445gum choose "Omg, yes!" "Nope, sorry!"