DEV Community

Alex Spinov
Alex Spinov

Posted on

Charm Gum Has a Free API That Most Developers Dont Know About

Gum by Charm is a tool for building beautiful shell scripts. It provides interactive prompts, spinners, file pickers, and styled text — all from bash.

Interactive Prompts

# Text input
NAME=$(gum input --placeholder "Your name")

# Multi-line text
BIO=$(gum write --placeholder "Tell us about yourself")

# Confirm
gum confirm "Delete all files?" && rm -rf ./temp

# Choose from list
COLOR=$(gum choose "Red" "Green" "Blue" "Yellow")

# Multi-select
FRAMEWORKS=$(gum choose --no-limit "React" "Vue" "Svelte" "Angular")

# File picker
FILE=$(gum file .)

# Filter (fuzzy search)
RESULT=$(cat list.txt | gum filter)
Enter fullscreen mode Exit fullscreen mode

Styled Output

gum style --foreground 212 --border-foreground 57 --border double --padding "1 2" "Hello, World!"

# Join styles
A=$(gum style --foreground 212 "Column A")
B=$(gum style --foreground 48 "Column B")
gum join --horizontal "$A" "$B"
Enter fullscreen mode Exit fullscreen mode

Spinners

gum spin --spinner dot --title "Deploying..." -- npm run deploy
gum spin --spinner moon --title "Building" -- make build
Enter fullscreen mode Exit fullscreen mode

Combine in Scripts

#!/bin/bash
NAME=$(gum input --placeholder "Project name")
TYPE=$(gum choose "Next.js" "Remix" "SvelteKit")
gum confirm "Create $TYPE project ?" || exit 0
gum spin --title "Creating..." -- npx create-next-app "$NAME"
gum style --foreground 48 "Project $NAME created!"
Enter fullscreen mode Exit fullscreen mode

Key Features

  • Beautiful interactive prompts
  • Styled text and borders
  • Spinners for loading
  • File picker and fuzzy filter
  • Composable in any shell script

Need to scrape or monitor web data at scale? Check out my web scraping actors on Apify or email spinov001@gmail.com for custom solutions.

Top comments (0)