← All posts

CLI

Gum: Add Interactive UI to Your Shell Scripts

Gum adds interactive prompts, menus, and styling to your shell scripts - polished terminal UI without the boilerplate.

G CLI

Shell scripts are great until they need to talk to a human. Prompting for input, offering a menu, confirming an action, or just printing something that looks nice usually means a pile of read and tput boilerplate. Gum (from Charm) makes it trivial. It's a single binary that gives your scripts interactive components - text input, filterable lists, multi-select, confirmations, spinners - and styling, each as a simple command you can drop into any bash script.

Interactive Components as Commands

Each piece of UI is just a command that prints the user's choice to stdout, so it slots into normal shell logic:

# Ask a question, capture the answer NAME=$(gum input --placeholder "Tool name") # Offer a filterable menu CAT=$(gum choose CLI DevOps Testing AI) # Confirm before doing something gum confirm "Deploy now?" && ./deploy.sh

Style Without the Escape Codes

Gum also handles presentation - bordered boxes, colors, layout - so a script's output can look intentional without you memorizing ANSI escape sequences. It turns a utilitarian script into something pleasant to use.

Rough Edges and Limitations

  • Interactive by nature. The prompts need a human; for pure automation you'd branch around them.
  • A dependency for your scripts. Anyone running the script needs gum installed.
  • Not a TUI framework. For a full application, a real TUI library fits better than shell glue.

For turning a rough personal script into a friendly little tool, gum is the fastest path from "works" to "nice to use."

Internal link suggestion: link "any bash script" to the just post, since gum-powered prompts pair well with just recipes.