Skip to main content

Automatically generate a Textual TUI for your Cick CLI

Project description

A pitcture of a trogon (bird) sitting on a laptop

Discord

Trogon

Auto-generate friendly terminal user interfaces for command line apps.

🎬 Video demonstration

A quick tour of a Trogon app applied to sqlite-utils.

https://github.com/Textualize/trogon/assets/554369/5ad8de04-d9f9-45af-aa21-7cb593951eff

Trogon works with the popular Click library for Python, but will support other libraries and even other languages in the future.

How it works

Trogon inspects your app and extracts a schema which describes the options / switches / help etc. It then uses that information to build a form with a familiar control for each option. Updating the form generates a command line which you can run with ctrl+R.

Ultimately we would like to formalize this schema and a protocol to extract or expose it from apps, which would allow Trogon to build TUIs for any CLI app, regardless of how it was build. If you are familiar with Swagger, think Swagger for CLIs.

Screenshots

Screenshot 2023-05-20 at 12 07 31 Screenshot 2023-05-20 at 12 08 21
Screenshot 2023-05-20 at 12 08 53 Screenshot 2023-05-20 at 12 09 47

Why?

Command line apps reward repeated use, but they lack in discoverability. If you don't use a CLI app frequently, or there are too many options to commit to memory, a Trogon TUI interface can help you (re)discover options and switches.

What does the name mean?

This project started life as a Textual experiement, which we have been giving give bird's names to. A Trogon is a beautiful bird I was lucky enough to photograph in 2017.

See also Frogmouth, a Markdown browser for the terminal.

Roadmap

Trogon is usable now. It is only 2 lines (!) of code to add to an existing project.

It is still in an early stage of development, and we have lots of improvements planned for it.

Installing

Trogon may be installed with PyPI.

pip install trogon

Quickstart

  1. Import from trogon import tui
  2. Add the @tui decorator above your click app. e.g.
    @tui()
    @click.group(...)
    def cli():
        ...
    
  3. Your click app will have a new tui command available.

See also the examples folder for two example apps.

Follow this project

If this app interests you, you may want to join the Textual Discord server where you can talk to Textual developers / community.

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

trogon-0.2.0.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

trogon-0.2.0-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file trogon-0.2.0.tar.gz.

File metadata

  • Download URL: trogon-0.2.0.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.11.1 Darwin/22.4.0

File hashes

Hashes for trogon-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5ca5a131594a78006bc4ef165d5b564efd6000de1da9c8d82b8e7ff1937ddc81
MD5 2d164ad0dc05a8228131f07929aa722c
BLAKE2b-256 3fcf2b2c305168df63928bec38cf1f4b81a60b4ac62ee9139892832fd7c3bf29

See more details on using hashes here.

File details

Details for the file trogon-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: trogon-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 23.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.11.1 Darwin/22.4.0

File hashes

Hashes for trogon-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ecb0e90a1442a521df8dde596011b9febdc6294c62b4979bc5ad4a46e896ffc4
MD5 a2d03ade3d7c40479ec047510f463f30
BLAKE2b-256 bef032757c7398682722671bb5a57f6ec82fde6adde8712109ba828c352e4f19

See more details on using hashes here.

Supported by

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