LinuxCommandLibrary

gum

Style terminal user interfaces

TLDR

Interactively pick a specific option to print to stdout

$ gum choose "[option_1]" "[option_2]" "[option_3]"
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 --spinner [dot|line|minidot|jump|pulse|points|globe|moon|monkey|meter|hamburger] --title "[loading...]" -- [command]
copy

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

Interactively prompt for multi-line text ( to save) and write to data.txt
$ gum write > [data.txt]
copy

SYNOPSIS

gum [command] [flags]

PARAMETERS

choose
    Let a user select an option from a list
Ex: gum choose {option1 option2 option3}

confirm
    Ask a user to confirm an action.
Ex: gum confirm "Are you sure?"

file
    Select a file from a list.
Ex: gum file

input
    Prompt a user for text input.
Ex: gum input --placeholder "Enter your name"

join
    Join text vertically or horizontally.
Ex: gum join --align center "Hello" "World"

progress
    Display progress bar.
Ex: gum progress --title "Downloading"

spin
    Show spinner while command executes
Ex: gum spin --title "Loading" -- gum confirm "Are you sure?"

style
    Style text.
Ex: gum style --foreground "#ffffff" "Some Styled Text"

write
    Write content to a file.
Ex: gum write --filename "file.txt"

filter
    Lets the user filter options from a list
Ex: gum filter {option1 option2 option3}

DESCRIPTION

Gum is a Go library and command-line tool for creating interactive terminal user interfaces (TUIs) with minimal code. It provides various components such as text input, file selection, confirm prompts, lists, spiners, progress bars and more, allowing developers to quickly build visually appealing and user-friendly terminal applications. Gum focuses on simplicity and ease of use, enabling developers to enhance their CLI tools with interactive features without extensive UI coding. The tool also comes with a built in style system, to allow customization of the TUI. It's commonly used to improve the user experience of shell scripts and command-line tools by adding interactive prompts and status displays.

ENVIRONMENT VARIABLES

Gum respects standard environment variables like `NO_COLOR` to disable color output.

SEE ALSO

dialog(1), whiptail(1), zenity(1)

Copied to clipboard