bath is a terminal UI (TUI) tool for managing environment-variable profiles (e.g. PATH, compiler flags, and linker flags) backed by SQLite.
Features
- Profiles in SQLite: store multiple named profiles and switch/export them consistently
- Interactive TUI: edit variables with live preview of the resulting export output
- Export for shell eval: print
export ...statements for the selected profile - Modes: prepend/append/replace behavior per variable
- Known-var catalog: ~220 env vars plus ~30 name patterns from AWS, Postgres, MySQL, Docker, Kubernetes, Go, Rust, Python, Node, Java, Terraform, GCP, Azure, Git and more, with their kind and separator filled in; extend it with your own
- Highlighting:
exportlines, previews and the:command line are colored using the active theme - Crash-safe terminal: raw mode and the alternate screen are always restored, even on errors or panics
Installation
Usage
- TUI mode:
-
TUI navigation (k9s-style)
-
Views: single active view with an always-visible bottom Details pane.
-
Global keys
:: command palette (jump views / run commands; the suggestion list scrolls with your selection)/: filter current view (live while typing,Enterapplies,Esccancels/clears)j/kor Arrow keys: move selectionEnter: drill into the selection (e.g. a variable's parts)Tab: cycle through viewsg/End: jump to bottomG/Home: jump to topq/Ctrl+C: quit
-
Common
:commands:profiles:vars:parts:items:defs:preview:export:help:use <profile>:themes(list available theme presets):theme <name>(switch theme; also persists to config):new-var(create a custom env var definition):new-item(create an item):quit
-
Vars view
- While filtering with
/, known catalog vars you have not added yet appear as dimmed+rows tagged with their group (e.g./pglistsPGHOST,PGPORT, …). A typed name that only matches a pattern (e.g.PGFOOviaPG*) is offered too. Enteron a+row opens its parts; the var definition (with the catalog's kind and separator) is saved together with its first value, so browsing never leaves empty definitions behind.
- While filtering with
-
:new-vardialog- Typing a name suggests catalog matches (
Up/Downto pick,Tabto complete); kind and separator are filled in from the catalog until you change them yourself.
- Typing a name suggests catalog matches (
-
Parts view (a variable's entries)
a/e/d/y: add / edit / delete / duplicate a part (scalar variables are guarded against gaining a second entry)J/K: reorder parts (disabled while a filter is active)m: pick up a part to move — a persistent HOLDING indicator appears and the part stays in place until you drop it withp, so quitting or pressingEscmid-move never loses anything
-
Profiles view
A/E/D: add / rename / delete a profile (duplicate and empty names are rejected)
-
Dialogs
Ctrl+T: toggle the kind field (ttypes normally into text fields)Esc/Ctrl+C: cancel; empty values and separators are rejected on save
-
Theming
- Config file:
~/.config/bath/config.toml(or$XDG_CONFIG_HOME/bath/config.toml) - Example:
- Config file:
[]
= "dracula"
# Optional overrides (accepts oklch(...) like DaisyUI, or #RRGGBB)
= "oklch(75% 0.18 346)"
= "#0b0f19"
- Your own known vars
- File:
~/.config/bath/catalog.toml(or$XDG_CONFIG_HOME/bath/catalog.toml) - Entries with the same
nameorpatternas a built-in one replace it; your patterns are tried before the built-in ones. Exact names always win over patterns. If the file cannot be parsed, bath starts with the built-in catalog and shows the error in the status line. - Example:
- File:
[[]]
= "ACME_API_TOKEN"
= "scalar"
= "acme"
[[]]
= "ACME_*_HOSTS" # `*` matches any characters
= "list"
= "," # lists default to ":"
= "acme"
- Demo
The README includes a GIF (assets/bath.gif) showing the TUI in action.
- Export a profile:
- Eval in your shell:
- Choose export mode (
prependis default):
- Export help:
Data storage
Bath stores profiles in a SQLite database at:
~/.bath.db
Development
pre-commit hooks
This repository includes a .pre-commit-config.yaml to run basic checks locally (formatting, clippy, tests).
CI
GitHub Actions runs the following on every push and pull request:
cargo fmt --checkcargo clippy -- -D warningscargo test
Releasing (crates.io)
Releases are automated with release-plz (it opens a release PR and publishes to crates.io after merge).
- Required GitHub setting: in
Settings → Actions → General, set workflow permissions to allow GitHub Actions to create and approve pull requests. See the official quickstart: https://release-plz.dev/docs/github/quickstart - Required secret:
CARGO_REGISTRY_TOKEN(crates.io token with scopespublish-newandpublish-update), used by.github/workflows/release-plz.yml.
License
GPL-3.0. See LICENSE.