Skip to content

jmcore.tui

jmcore.tui

JoinMarket-NG TUI menu launcher.

Thin entry point that locates and execs menu.joinmarket-ng.sh. It is registered as the jm-ng console script via jmcore's pyproject.toml, so after pip install jmcore users can simply run jm-ng from the terminal.

The launcher resolves the shell script in this order:

  1. $JM_NG_MENU environment variable override.
  2. Package data shipped inside the jmcore wheel (jmcore/data/menu.joinmarket-ng.sh).
  3. Relative to the repo root (editable / development installs).
  4. $HOME/.joinmarket-ng/menu.sh (standalone manual installs).

If whiptail is not found on $PATH the launcher exits with a helpful message.

Functions

main() -> None

Launch the JoinMarket-NG TUI menu.

Source code in jmcore/src/jmcore/tui.py
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
def main() -> None:
    """Launch the JoinMarket-NG TUI menu."""
    # Pre-flight: whiptail is required
    if not shutil.which("whiptail"):
        print(
            "Error: 'whiptail' is required but not found.\n"
            "Install it with your package manager, e.g.:\n"
            "  sudo apt install whiptail          # Debian/Ubuntu\n"
            "  sudo pacman -S libnewt              # Arch Linux",
            file=sys.stderr,
        )
        raise SystemExit(1)

    script = _find_menu_script()
    if script is None:
        print(
            "Error: Could not locate the TUI menu script.\n"
            "Expected locations:\n"
            "  - jmcore package data (pip install jmcore)\n"
            "  - <repo>/scripts/menu.joinmarket-ng.sh  (development)\n"
            "  - ~/.joinmarket-ng/menu.sh               (standalone install)\n"
            "\n"
            "You can also set the JM_NG_MENU environment variable to the\n"
            "full path of the script.",
            file=sys.stderr,
        )
        raise SystemExit(1)

    # Replace the current process with bash running the script
    os.execvp("bash", ["bash", str(script)])