Skip to content

fresh2dev/argparse-tui

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code
This branch is 59 commits ahead, 1 commit behind Textualize:main.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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:

  1. Display the TUI form directly:
from argparse import ArgumentParser
from argparse_tui import invoke_tui

parser = ArgumentParser()
...
invoke_tui(parser)
  1. 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.


License GitHub tag (with filter) GitHub last commit (branch) GitHub Repo stars Funding

Sponsor this project

Languages

  • Python 93.7%
  • SCSS 4.2%
  • HTML 1.7%
  • Dockerfile 0.4%