LinuxCommandLibrary

gum

Style terminal user interfaces

TLDR

Interactively pick a specific option to print to stdout

$ gum choose ["option1" "option2" "..."]
copy

Open an interactive prompt for the user to input a string with a specific placeholder
$ gum input --placeholder "[value]"
copy

Open an interactive confirmation prompt and exit with either <0> or <1>
$ gum confirm "[Continue?]" --default=false --affirmative "[Yes]" --negative "[No]" [&& echo "Yes selected" || echo "No selected"]
copy

Show a spinner while a command is taking place with text alongside
$ gum spin [[-s|--spinner]] [dot|line|minidot|jump|pulse|points|globe|moon|monkey|meter|hamburger] --title "[loading...]" [command]
copy

Format text to include emojis
$ gum format [[-t|--type]] [emoji] "[:smile: :heart: hello]"
copy

Interactively prompt for multi-line text and write the input to a file
$ gum write > [path/to/file]
copy

SYNOPSIS

gum [COMMAND] [ARGS]

PARAMETERS

--help
    Show context-sensitive help

--version
    Print the version number

DESCRIPTION

gum is an open-source CLI utility from the Charm Bracelet project designed to create beautiful, interactive command-line interfaces. It provides a collection of subcommands for common UI elements like styled text output, user input prompts, spinners, fuzzy finders, and more, making shell scripts more user-friendly and visually appealing.

Key features include support for 256-color terminals, unicode characters, and smooth animations. It's lightweight, dependency-free (after installation), and outputs plain text or ANSI for easy piping in scripts. Popular for enhancing tools like installers, config wizards, or menus.

Installation is simple via package managers (brew install gum, apt install gum) or binaries from GitHub. Written in Go, it's fast and portable across Unix-like systems. Developers use it to replace clunky read or dialog prompts with modern alternatives, improving UX without GUI dependencies.

Subcommands handle specific tasks: style for formatting text, input for single-line prompts, choose for menus, confirm for yes/no, and others like spin, filter, and table. Combine them in bash/zsh scripts for polished CLIs.

CAVEATS

Requires terminal with ANSI color and unicode support; subcommand-specific options vary and must be checked with gum <subcommand> --help. Not installed by default on most systems.

COMMON SUBCOMMANDS

choose: Interactive menu.
confirm: Yes/no prompt.
input: Text input.
style: Styled text output.
spin: Loading spinner.
Full list via gum --help.

EXAMPLE USAGE

gum style --foreground 212 --border double --align center 'Hello World'
OS=$(gum choose 'macOS' 'Linux' 'Windows')

HISTORY

Developed by the Charm open-source team starting around 2021 as part of the Bracelet suite. Inspired by modern TUI libraries; actively maintained with regular releases on GitHub (charmbracelet/gum). Gained popularity for simplifying interactive scripts in DevOps and tooling.

SEE ALSO

dialog(1), whiptail(1), fzf(1)

Copied to clipboard