argparse-tui
Your Argparse CLI, now with a TUI.
Documentation | Slide Deck | Git Repo
I was several months into developing my Python CLI framework, Yapx, when I saw a post on Hackernews of an awesome tool, Trogon, which makes it effortless to create a TUI form for a Click CLI app. I was stunned; I knew I had to integrate it into Yapx. But Yapx is built on Python's native Argparse library, not Click. So, I forked Trogon and hacked away until it became this project, argparse-tui.
argparse-tui can display a TUI of your Python Argparse CLI in one of two ways:
- Display the TUI form directly:
from argparse import ArgumentParser
from argparse_tui import invoke_tui
parser = ArgumentParser()
...
invoke_tui(parser)
- Add an argument (or command) to the parser that, when provided, displays the TUI form:
from argparse import ArgumentParser
from argparse_tui import add_tui_argument
parser = ArgumentParser()
add_tui_argument(parser)
...
parser.parse_args()
In addition to Argparse support, this fork adds some sweet features including:
- Vim-friendly keybindings.
- Redaction of secret values.
- Pre-populating TUI fields with command-line argument values.
Install¶
pip install argparse-tui
P.S.¶
If you appreciate argparse-tui, check out Yapx, Myke, and TUIview.