Configs2026年4月15日·1 分钟阅读

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.

Introduction

Gum is part of the Charm toolkit (bubbletea, lipgloss). It exposes every TUI building block as a standalone subcommand you can call from bash, making your install scripts, setup wizards, and dev-ops runbooks actually pleasant to use. It's the missing UI layer between bash and full Go TUI apps.

What Gum Does

  • gum input — prompt with placeholders, masks, validation.
  • gum choose — single/multi-select from a list.
  • gum confirm — yes/no dialog with keyboard controls.
  • gum file — file picker TUI.
  • gum spin — spinner around any subprocess.
  • gum style / gum format — paint text with lipgloss.
  • gum table — render CSVs as styled tables.
  • gum log — leveled structured log output.

Architecture Overview

Each subcommand is a thin CLI over a bubbletea program. The output goes to stdout (as the selected value) while the TUI draws on stderr, so composing with $(gum ...) in bash just works. --theme / lipgloss flags customize colors without any global config.

Self-Hosting & Configuration

  • Install via brew, apt, dnf, pacman, scoop, winget.
  • Themes via flags: --height, --cursor, --prompt, --cursor.foreground.
  • GUM_* env vars mirror flags.
  • Works in CI when --no-color or CI=true.
  • Pair with charm freeze to render docs.

Key Features

  • Composes with bash — drop into existing scripts.
  • Every TUI primitive (input, choose, file, spin, table).
  • Beautiful defaults; deeply themeable.
  • Small static Go binary; cross-platform.
  • CI-friendly degradation.

Comparison with Similar Tools

  • fzf — unmatched for fuzzy-select; gum's choose is simpler + themed.
  • dialog/whiptail — retro, curses-based; gum is modern.
  • bubbletea (Go lib) — for full apps; gum is for scripts.
  • inquirer.js — Node-only.
  • enquirer — Node-only.

FAQ

Q: Read password without echo? A: gum input --password.

Q: Multi-select? A: gum choose --no-limit.

Q: Works over SSH? A: Yes, as long as the TTY is present.

Q: Reusable themes? A: Export GUM_INPUT_CURSOR_FOREGROUND=212 etc. in a sourcing script.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产