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.2.tar.gz (12.9 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.2-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mango_tui-0.2.2.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mango_tui-0.2.2.tar.gz
Algorithm Hash digest
SHA256 39cd3ae00370baa7cca773b6f12801efcb6056239c84fabc0ef5fa978ec2c690
MD5 fe580b847236dd0ac8cb5868c2737ba6
BLAKE2b-256 b9a6adee983a2a3d01db3b4449f83c9689844e6c88cef876d823cfe403ce1a78

See more details on using hashes here.

Provenance

The following attestation bundles were made for mango_tui-0.2.2.tar.gz:

Publisher: publish.yml on juanleon8581/mango-assistant

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: mango_tui-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mango_tui-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 595f9c5136f9083d295655fb409e95c2e4aacfe0fc1b6091531cda59e526033f
MD5 6869753cb5e9ef2253433a58a8e570ef
BLAKE2b-256 1df02b5c37c71f6f7e9408f4072ee5f598ded4ede8b7905249bb31b9e9029baf

See more details on using hashes here.

Provenance

The following attestation bundles were made for mango_tui-0.2.2-py3-none-any.whl:

Publisher: publish.yml on juanleon8581/mango-assistant

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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