Skip to main content

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

GitHub release (latest SemVer) GitHub Release Date License GitHub Repo stars GitHub issues GitHub pull requests PyPI - Downloads Docker Pulls Changelog Funding


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 the examples/ 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tuiview-0.1.0a2.tar.gz (61.0 kB view hashes)

Uploaded Source

Built Distribution

tuiview-0.1.0a2-py3-none-any.whl (51.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page