Cette page est affichée en anglais. Une traduction française est en cours.
SkillsApr 15, 2026·2 min de lecture

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.

Charm
Charm · Community
Prêt pour agents

Installation avec revue préalable

Cet actif nécessite une revue. Le prompt copié demande un dry-run, affiche les écritures, puis continue seulement après confirmation.

Needs Confirmation · 66/100Policy : confirmer
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Community
Point d'entrée
Gum guide
Commande avec revue préalable
npx -y tokrepo@latest install 43c00283-38c4-11f1-9bc6-00163e2b0d79 --target codex

Dry-run d'abord, confirmez les écritures, puis lancez cette commande.

TL;DR
Gum turns plain bash scripts into interactive TUI experiences with prompts, spinners, file pickers, and styled text.
§01

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.

§02

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.

§03

How to use

  1. Install Gum:
brew install gum
  1. 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
  1. Combine commands for complex flows:
# Interactive git commit
git commit -m "$TYPE($SCOPE): $DESC"
§04

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"
§05

Related on TokRepo

§06

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-limit flag allows multiple selections but returns them on separate lines. Use while read or 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.

Questions fréquentes

What is Gum used for?+

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.

Does Gum work on Linux and macOS?+

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.

Can I use Gum in CI pipelines?+

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.

What is the Charm ecosystem?+

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.

How do I style Gum output?+

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.

Sources citées (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

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires