charmbracelet

gum: Build Interactive, Polished Shell Scripts

Gum adds ready-to-use interactive prompts and styled output to shell scripts without requiring Go code. It suits developers who want friendlier command-line workflows, provided their scripts can rely on a terminal UI.

Stars
24.5k
Forks
554
Stars, last 10 days
+44

Our take

Health score

56/100

How it is scored
Activity
50
Community
75
Issues
35
Pull requests
63

+44 stars in the last 10 days

  • Slower to close issues than 91% of the projects we track

Overview

Gum is a Go-based CLI that brings interactive terminal components and styled text to shell scripts. It solves the friction of building prompts and presentation directly in shell, letting script authors compose existing commands without writing a Go application.

It is most useful for developers and shell users who want interactive tools for local workflows, such as selecting files or confirming an action. Its commands return output that scripts can capture and pass to other tools.

Key Features

  • Prompt for single-line or multiline input, including password input.
  • Let users choose from a list or fuzzy-filter supplied items, with support for multiple selections.
  • Confirm actions with a success or negative exit code.
  • Browse files and page through long documents in the terminal.
  • Show a spinner while a command runs.
  • Style, join, and format terminal text, including Markdown, templates, code, and emoji.
  • Render tables and log messages with configurable presentation.
  • Customize command options with flags or environment variables.

Use Cases

  • Developers can build a commit-message helper that gathers a type, scope, summary, and description before committing.
  • Shell users can filter Git history, branches, or pull requests and pass a selection to Git or GitHub CLI.
  • System administrators can add a confirmation step before a destructive command, such as removing a file or uninstalling packages.
  • Dotfile maintainers can create interactive menus and prompts without implementing terminal interfaces in Go.

Getting Started

Install with Go:

go install charm.land/gum/v2@latest

See the README for package-manager installation options, command details, and examples.

Considerations

Gum is designed for interactive terminal workflows, so prompts and selections are intended for user-driven scripts rather than unattended jobs. Its value is greatest when scripts need a terminal UI; for simple non-interactive pipelines, standard shell utilities may be sufficient. The repository is MIT-licensed.

Found this useful?

Share it with someone who would like gum.

Comparisons