Gum — A Tool for Glamorous Shell Scripts by Charm
Gum is a CLI toolkit for building interactive shell scripts with spinners, prompts, file pickers, tables, and styled output — turning bash scripts into modern TUI experiences.
What it is
Gum is a command-line toolkit by Charm for building interactive shell scripts. It provides standalone commands for spinners, confirmation prompts, text inputs, file pickers, tables, and styled output. Each command is a single binary call you pipe into or compose with standard shell constructs.
Gum is for shell script authors who want to add interactivity without switching to a full TUI framework. If you write bash scripts for developer tooling, onboarding flows, or CI prompts, Gum makes them polished and user-friendly with minimal code.
How it saves time or tokens
This workflow provides the installation command and ready-to-use Gum recipes. Instead of building interactive prompts from scratch with read and select, you get single-line commands that handle input validation, styling, and user experience. The interactive commit message recipe alone replaces a multi-line bash function.
How to use
- Install Gum:
brew install gum
- Use Gum commands in your shell scripts:
# Interactive selection
TYPE=$(gum choose feat fix docs style refactor test chore)
# Text input with placeholder
SCOPE=$(gum input --placeholder 'scope')
# Multi-line text area
DESC=$(gum write --placeholder 'Describe your changes...')
# Confirmation
gum confirm 'Deploy to production?' && deploy
- Combine commands for complex flows:
# Interactive git commit
git commit -m "$TYPE($SCOPE): $DESC"
Example
#!/bin/bash
# Interactive project setup script using Gum
NAME=$(gum input --placeholder 'Project name')
LANG=$(gum choose 'TypeScript' 'Python' 'Go' 'Rust')
FEATURES=$(gum choose --no-limit 'CI/CD' 'Docker' 'Linting' 'Testing')
gum confirm "Create $LANG project '$NAME'?" || exit 0
gum spin --title "Setting up $NAME..." -- sleep 2
echo "Project $NAME created with: $FEATURES" | gum format
# File picker for log analysis
LOG=$(gum file /var/log/)
gum pager < "$LOG"
Related on TokRepo
- Automation tools -- Shell scripting and automation workflows
- AI coding tools -- Developer productivity tools
Common pitfalls
- Gum requires a terminal that supports ANSI escape codes. Piping Gum output through non-TTY contexts (like cron jobs or CI without pseudo-TTY) disables interactivity.
- The
gum choose --no-limitflag allows multiple selections but returns them on separate lines. Usewhile reador array assignment to capture multiple values. - Gum's styled output depends on terminal color support. In minimal containers or SSH sessions without TERM set, styling may not render.
Frequently Asked Questions
Gum adds interactive UI components to shell scripts. It provides commands for text input, selection menus, confirmation dialogs, spinners, file pickers, and styled text output. Each is a standalone binary you call from bash.
Yes. Gum is available via Homebrew on macOS, as a .deb and .rpm package on Linux, and as a standalone binary. It also works on Windows via Scoop or direct download.
Gum works in CI if you provide default values or skip interactive prompts. In non-interactive contexts, use flags like --value for gum input or pipe choices via stdin. Without a TTY, interactive selection is not available.
Charm is a company that builds open-source terminal tools in Go. Their ecosystem includes Gum (shell scripts), Bubbletea (Go TUI framework), Lipgloss (Go terminal styling), and Charm Cloud. All focus on making terminals more expressive.
Use gum style with flags like --foreground, --background, --bold, --italic, and --border. You can also pipe text through gum format for automatic markdown-like formatting in the terminal.
Citations (3)
- Gum GitHub— Gum is a CLI toolkit by Charm for interactive shell scripts
- Charm Homepage— Charm builds open-source terminal tools in Go
- Gum README— Commands for spinners, prompts, file pickers, and styled output
Related on TokRepo
Discussion
Related Assets
Miniflux — Minimalist Self-Hosted Feed Reader
Miniflux is an opinionated, minimalist RSS and Atom feed reader written in Go that focuses on simplicity, speed, and content readability.
Kanboard — Minimalist Kanban Project Management
Kanboard is a free and open-source Kanban project management tool focused on minimalism, productivity, and getting things done without unnecessary complexity.
Homer — Static Server Dashboard with YAML Configuration
Homer is a dead-simple static dashboard for your server services, configured entirely through a single YAML file with no database or backend required.