A TUI for every CLI.
Project description
TUIview [tv
]
A TUI for every CLI.
Links | |
---|---|
Code Repo | https://www.github.com/fresh2dev/tuiview |
Mirror Repo | https://www.f2dv.com/r/tuiview |
Documentation | https://www.f2dv.com/r/tuiview |
Changelog | https://www.f2dv.com/r/tuiview/changelog |
License | https://www.f2dv.com/r/tuiview/license |
Funding | https://www.f2dv.com/fund |
Overview
argparse-tui
is a Python library that will display a Textual UI (TUI) given a Python argparse ArgumentParser. With it, Argparse becomes the specification language for your TUI, powered by the Textualize TUI framework.
TUIview is a command-line tool that contains a collection of "equivalent-enough" (and untested) Argparse implementations of common CLI tools.
Turns out, ChatGPT is decent at translating structured help text into a Python argparse ArgumentParser. This project does not use an AI, but what I've done so far is use GPT 3.5 to generate "equivalent-enough" Argparse implementations of git
, rsync
, and grep
. I plan to clean these up some and add more for other great CLI tools like fd
and rg
.
Install
Install using pipx
(or pip
):
pipx install tuiview
Use
Installing TUIview gives you both tuiview
and tv
for short.
________________________________________________________________________________
$ tv
________________________________________________________________________________
helpful parameters:
-h, --help Show this help message.
--tui Show Textual User Interface (TUI).
--help-all Show help for all commands.
--version Show the program version number.
commands:
<COMMAND>
from-file
rsync
grep
pastel
git
Built-in Tools
Launch the TUI of a known tool by providing its name:
tv git
tv rsync
...
Notice how git
has subcommands (commit
, merge
, ...). The TUI can be limited to a specific command by giving its name:
tv git commit
Any other arguments are parsed and passed-through to the TUI:
tv git commit -m 'hello' -m 'world'
Load from File
Recall that argparse-tui allows us to use argparse as a specification language for Textual UIs. So, given a file defining and populating an argparse ArgumentParser with the variable name parser
, you can feed it into tuiview
and view the tui, dude :metal:
For example, save the following to echo.py
:
import argparse
parser = argparse.ArgumentParser(prog="echo")
parser.add_argument("text", nargs="*")
parser.add_argument(
"-n",
action="store_true",
help="do not output the trailing newline",
)
Hint: see this, and
ping.py
in theexamples/
folder
Now display the TUI using: tv from-file echo.py
Support
If you think this is as cool as I do and want to contribute and help curate files of argparse parsers for various CLI tools, rock on :metal:
If this project delivers value to you, please provide feedback, code contributions, and/or funding.
Brought to you by...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for tuiview-0.1.0a2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d08ac8b3c87931d0a48d795a3520e65dc4803f747dc165367110e637304d699 |
|
MD5 | 5c40497c984c380397ab3968a09beaa6 |
|
BLAKE2b-256 | c1832057397236bbe62d3c01cd42cbf5daf864683c649c949529e333e5d06ed0 |