Skip to main content

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 key and shortcut must match the default exactly.
  • To add a new category: both the key and shortcut must not exist in the defaults.
  • Within a shared category, each local macro must have a key and shortcut not 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

Dependencies: textual, pyyaml

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

mango_tui-0.2.0.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mango_tui-0.2.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file mango_tui-0.2.0.tar.gz.

File metadata

  • Download URL: mango_tui-0.2.0.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

Hashes for mango_tui-0.2.0.tar.gz
Algorithm Hash digest
SHA256 354abbf8e7cbd97f924d11139cb2088887d849a24905af155dcfa946d2ef4a84
MD5 8332ffca7bfe5d6ba187e9a09a78decc
BLAKE2b-256 455fe5230199c265d29844cb4465a5c525624850d907109be1da5a74aaf2e771

See more details on using hashes here.

File details

Details for the file mango_tui-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: mango_tui-0.2.0-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

Hashes for mango_tui-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 98d1f40749f5d26a1265ea30c65f6cd8f7cf8378fbcb08bf30a1de0b94ef1b14
MD5 d5d4e57b740dcafed81abc5ccf93f028
BLAKE2b-256 488bf0d50f281c7aad52d2766c902b41ca7531101ad0ec51d0f674d559507cb4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page