Keyboard-driven TUI for running multi-step shell command sequences defined in YAML
Project description
mango
A keyboard-driven terminal UI for running multi-step shell command sequences defined in YAML.
What it does
mango lets you define "macros" — named sequences of shell commands — grouped into categories. You run them by navigating the TUI or typing shortcut combos like g>su (category g, macro su). Macros can prompt for parameters before running.
Requirements
- Python 3.10+
Installation
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
Usage
mango
Navigate with arrow keys or j/k. Press Enter to run a macro. If the macro has params, a dialog prompts for them before execution. Output streams to a panel at the bottom. Press q to quit.
Shortcut mode: type <category_shortcut>><macro_shortcut> (e.g. g>su) to jump directly to a macro from anywhere in the TUI.
Config
mango manages three files under ~/.config/mango/ (respects $XDG_CONFIG_HOME):
| File | Purpose |
|---|---|
config.default.yaml |
Macros bundled with the package — updated automatically on each startup |
config.local.yaml |
Your personal macros — optional, persists across package updates |
commands.yaml |
Merge output read by the app — do not edit manually |
On each startup mango propagates the built-in defaults and merges them with your local config into commands.yaml. The merge is lazy: it only runs when either source file changes.
Adding your own macros
Create ~/.config/mango/config.local.yaml with the same YAML schema:
categories:
git:
shortcut: "g" # must match the default exactly to add macros into it
macros:
my-cleanup:
shortcut: "cl"
description: "Delete merged branches"
steps:
- git branch --merged | grep -v main | xargs git branch -d
my-tools: # entirely new category — key and shortcut must not exist in defaults
shortcut: "t"
macros:
hello:
shortcut: "hi"
description: "Say hello"
steps:
- echo "hello"
Merge rules:
- To add macros into an existing default category: the category
keyandshortcutmust match the default exactly. - To add a new category: both the
keyandshortcutmust not exist in the defaults. - Within a shared category, each local macro must have a
keyandshortcutnot already used by the defaults.
Conflicts are skipped and reported to stderr before the TUI opens:
[mango] config conflict: category 'tools' — shortcut 'g' already used by 'git' (skipped)
[mango] config conflict: macro 'git>status' — key already defined in default (skipped)
Schema reference
categories:
git:
shortcut: "g"
macros:
switch-and-pull:
shortcut: "su"
description: "Switch branch, fetch and pull"
params:
- name: branch
prompt: "Branch name"
steps:
- git checkout {branch}
- git fetch
- git pull
status:
shortcut: "st"
description: "Show git status"
steps:
- git status
shortcut— unique within its scope (category shortcuts must be globally unique; macro shortcuts must be unique within their category)params— optional list of{name, prompt}pairs; referenced in steps as{name}steps— shell commands run sequentially; first non-zero exit code aborts the sequence
Development
# Test with a local config instead of ~/.config/mango/
XDG_CONFIG_HOME=.test-config mango
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mango_tui-0.2.1.tar.gz.
File metadata
- Download URL: mango_tui-0.2.1.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
874b1ce261f354c980491353166c4d8ced87a406d2503c2eec39fbee12dd7f1a
|
|
| MD5 |
1f90e70457f4f893fba5005d91866aa0
|
|
| BLAKE2b-256 |
3bc9f1543b95bc3144fbe436d8995cceca8de5ee757e1ac157f9b92beac7dc55
|
File details
Details for the file mango_tui-0.2.1-py3-none-any.whl.
File metadata
- Download URL: mango_tui-0.2.1-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
514ebbe796c696bd729393443dc1820c6b844e4c36011e82f2a46b2da849589e
|
|
| MD5 |
bd061d9de55f26f1c5b364fb395ecf3a
|
|
| BLAKE2b-256 |
4d1edf3b52218a2ebd3b5c5c89c3690a1a6552aa1cbc788b1b1ea221e9c62b78
|