v0.15.0
charmbracelet/gumv0.15.0Jan 13, 2025by github-actions[bot]
AI Summary
A significant release that detangles Gum from the Huh library, introduces timeout support with units, adds new flags for filtering and file picking, and updates CSV parsing.
Key Highlights
- Detangles Gum from Huh library for better maintainability
- Adds timeout support with units (ms, s, m) to multiple commands
- New `--select='*'` flag for choose command
- Filter improvements: `--input-delimiter`, `--output-delimiter`, `--selected`, and `--no-strict`
- Filter's `--sort` flag is deprecated in favor of `--[no-]fuzzy-sort`
Breaking Changes
- Filter's `--sort` flag is deprecated in favor of `--[no-]fuzzy-sort`
New Features
- --label-delimiter
- --select='*'
- --show-output
- --header
- --input-delimiter
- --output-delimiter
- --no-strict
- GUM_LOG_LEVEL
- --show-stdout
- --show-stderr
- --lazy-quotes
- --fields-per-record
Full Release Notes
# No longer a sticky situation This release contains a small boatload of fixes and quality-of-life features across the board by the great @caarlos0 and some awesome contributors. Most importantly we detangled Gum and [Huh](https://github.com/charmbracelet/huh). The two libraries were too tightly coupled creating a difficult environment to maintain. With this separation, Gum much easier to maintain, especially for contributors. [Chew on that!](https://github.com/charmbracelet/gum/pull/742) ## General Stuff No more weird ANSI: `gum` now strips ANSI sequences by default. Want ‘em back? just add `--no-strip-ansi`. We fixed some bugs with existing timeouts + they can now be used in `confirm`, `choose`, `file`, `filter`, `input`, `pager`, and `spin`. You can specify the units, i.e. `--timeout=750ms`, `--timeout=1m30s` ## Choose Sometimes you want the user-facing choice to be different than the outputted value. Now you can do that with `--label-delimiter`: ```bash $ printf 'Pocky:0\nRamen:1\nShrimp Chips:2\n' | gum choose --label-delimiter=':' ``` Want to select all options by default? Use `--select='*'`. ```bash $ printf 'Pocky\nRamen\nShrimp Chips\n' | gum choose --select='*' ``` ## Confirm No you can print the chosen value with `--show-output`: ```bash $ gum confirm --show-output 'Do you agree?' Do you agree? No exit status 1 ``` ## File You can now add a header to your filepickers with the `--header` set of flags. ``` gum file --header="Whatcha gonna pick?" ``` <p><img width="500" alt="file" src="https://github.com/user-attachments/assets/c22335f7-6b82-4619-aecb-b763a9997f0f" /></p> For details see `gum file --help`. ## Filter ### Better delimiters, select all, and so on Press <kbd>ctrl+a</kbd> to select all choices, <kbd>esc</kbd> to unfocus the filter field. Want some defaults? Use `--selected` to preselect choices. You can also use `--input-delimiter` and `--output-delimiter` for more flexibility around input and output. ```bash $ echo "JS|Android|iOS" | gum filter --selected='*' --input-delimiter="|" --no-limit --output-delimiter="," ``` ### Freeform input Filter's `--no-strict` allows you to create a new option if no matches are found; it's essentially a free input field. Go crazy! ### Sort: we fixed it Filter's `--sort` would sort by score which was causing some confusion for users. To clarify this behaviour, `--sort` is deprecated in favour of `--[no]-fuzzy-sort`. Want to sort alphabetically? Leverage the `sort` command in a pipeline: ```bash $ cat input.txt | sort | gum filter --no-sort ``` ## Log Now you can set a minimum log level with `GUM_LOG_LEVEL`. Valid values are `debug`, `info`, `warn`, `error`, and `fatal`. ## Spin You can now use `--show-stdout` and `--show-stderr` to print output: ```bash $ gum spin --show-stdout --title "Running command..." -- sleep 10 && echo hello ``` ## Table We expanded the `table` API to allow users to control more fields in `csv.Reader` through gum. This includes `--lazy-quotes` and `--fields-per-record`. This should fix issues with gum struggling to read CSV files properly. For details see `gum table --help`. We also made a bunch of rendering improvements such as growing the table rows based on `--columns`, settings sane defaults widths, ignoring BOMs (byte order marks), and so on. ## Changelog ### New! - feat(choose): --selected="\*" to select all by @caarlos0 in https://github.com/charmbracelet/gum/pull/769 - feat(choose,filter): --input-delimiter --output-delimiter by @caarlos0 in https://github.com/charmbracelet/gum/pull/779 - feat(confirm): add --show-output by @vahnrr in https://github.com/charmbracelet/gum/pull/427 - feat(file): add --header by @caarlos0 in https://github.com/charmbracelet/gum/pull/768 - feat(file): show permissions and size by @caarlos0 in https://github.com/charmbracelet/gum/pull/717 - feat(filter): --select-if-one returns if single match by @caarlos0 in https://github.com/charmbracelet/gum/pull/778 - feat(filter): allow to focus out of filter by @caarlos0 in https://github.com/charmbracelet/gum/pull/776 - feat(filter): allow to pre-select items with --selected by @caarlos0 in https://github.com/charmbracelet/gum/pull/777 - feat(filter): ctrl+a to toggle select all by @caarlos0 in https://github.com/charmbracelet/gum/pull/770 - feat(log): support setting minimum log level with GUM_LOG_LEVEL by @caarlos0 in https://github.com/charmbracelet/gum/pull/723 - feat(spin): --show-stdout --show-stderr by @caarlos0 in https://github.com/charmbracelet/gum/pull/774 - feat(style): trim line spaces by @caarlos0 in https://github.com/charmbracelet/gum/pull/767 - feat(table): --lazy-quotes and --fields-per-record by @caarlos0 in https://github.com/charmbracelet/gum/pull/759 - feat(table): add help by @caarlos0 in https://github.com/charmbracelet/gum/pull/756 - feat(table): set --print if stdout is not a terminal by @caarlos0 in https://github.com/charmbracelet/gum/pull/762 - feat(version): adds command to check current gum version by @caarlos0 in https://github.com/charmbracelet/gum/pull/775 - feat: adding return column to table command by @deicon in https://github.com/charmbracelet/gum/pull/415 - feat: allow cursor option in file by @radar07 in https://github.com/charmbracelet/gum/pull/667 - feat: esc exit 1, ctrl+c exit 130, help arrow order by @caarlos0 in https://github.com/charmbracelet/gum/pull/771 - feat: handle focus/blur events by @caarlos0 in https://github.com/charmbracelet/gum/pull/749 - feat: improve handling ctrl+c and timeouts by @caarlos0 in https://github.com/charmbracelet/gum/pull/747 ### Fixed - fix(choose): --ordered by @caarlos0 in https://github.com/charmbracelet/gum/pull/722 - fix(choose,confirm,file,filter,input,pager,spin): timeout default unit by @caarlos0 in https://github.com/charmbracelet/gum/pull/724 - fix(confirm) --timeout was ignored, now works as documented by @dpritchett in https://github.com/charmbracelet/gum/pull/697 - fix(confirm,choose,file,input): timeout handling by @caarlos0 in https://github.com/charmbracelet/gum/pull/718 - fix(filter): --no-strict not working, also weird behavior by @caarlos0 in https://github.com/charmbracelet/gum/pull/737 - fix(filter): abort on ctrl+q by @caarlos0 in https://github.com/charmbracelet/gum/pull/721 - fix(pager): do not strip ansi sequences by @caarlos0 in https://github.com/charmbracelet/gum/pull/754 - fix(pager): use help bubble by @caarlos0 in https://github.com/charmbracelet/gum/pull/748 - fix(spin): if not a tty, only print title, do not open tty for stdin by @caarlos0 in https://github.com/charmbracelet/gum/pull/763 - fix(spin): indenting lines when command is piped by @aymanbagabas in https://github.com/charmbracelet/gum/pull/636 - fix(spin): interrupt child process on ctrl+c by @caarlos0 in https://github.com/charmbracelet/gum/pull/732 - fix(stdin): trim space instead of \n by @caarlos0 in https://github.com/charmbracelet/gum/pull/761 - fix(table): grow table rows based on --columns by @caarlos0 in https://github.com/charmbracelet/gum/pull/760 - fix(table): ignore BOM by @caarlos0 in https://github.com/charmbracelet/gum/pull/757 - fix(table): only set height if > 0 by @caarlos0 in https://github.com/charmbracelet/gum/pull/716 - fix(table): set widths by @caarlos0 in https://github.com/charmbracelet/gum/pull/758 - fix(write): max height, max chars by @caarlos0 in https://github.com/charmbracelet/gum/pull/753 - fix: clarify filter --sort flag by @caarlos0 in https://github.com/charmbracelet/gum/pull/738 - fix: strip ansi sequences from stdin by @caarlos0 in https://github.com/charmbracelet/gum/pull/739 - fix: quote tmux session name in code sample by @oalders in https://github.com/charmbracelet/gum/pull/745 ### Other Stuff - refactor: removing huh as a dep by @caarlos0 in https://github.com/charmbracelet/gum/pull/742 - chore(nix): update src hash by @ctn-malone in https://github.com/charmbracelet/gum/pull/733 ## New Contributors - @dpritchett made their first contribution in https://github.com/charmbracelet/gum/pull/697 - @radar07 made their first contribution in https://github.com/charmbracelet/gum/pull/667 - @ctn-malone made their first contribution in https://github.com/charmbracelet/gum/pull/733 - @oalders made their first contribution in https://github.com/charmbracelet/gum/pull/745 **Full Changelog**: https://github.com/charmbracelet/gum/compare/v0.14.5...v0.15.0 --- <details> <summary>Verifying the artifacts</summary> First, download the [`checksums.txt` file](https://github.com/charmbracelet/gum/releases/download/0.15.0/checksums.txt), for example, with `wget`: ```bash wget 'https://github.com/charmbracelet/gum/releases/download/v0.15.0/checksums.txt' ``` Then, verify it using [`cosign`](https://github.com/sigstore/cosign): ```bash cosign verify-blob \ --certificate-identity 'https://github.com/charmbracelet/meta/.github/workflows/goreleaser.yml@refs/heads/main' \ --certificate-oidc-issuer 'https://token.actions.githubusercontent.com' \ --cert 'https://github.com/charmbracelet/gum/releases/download/v0.15.0/checksums.txt.pem' \ --signature 'https://github.com/charmbracelet/gum/releases/download/v0.15.0/checksums.txt.sig' \ ./checksums.txt ``` If the output is `Verified OK`, you can safely use it to verify the checksums of other artifacts you downloaded from the release using `sha256sum`: ```bash sha256sum --ignore-missing -c checksums.txt ``` Done! You artifacts are now verified! </details> <a href="https://charm.sh/"><img alt="The Charm logo" src="https://stuff.charm.sh/charm-badge.jpg" width="400"></a> Thoughts? Questions? We love hearing from you. Feel free to reach out on [Twitter](https://twitter.com/charmcli), [The Fediverse](https://mastodon.technology/@charm), or on [Discord](https://charm.sh/chat).