Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Easily turn your Click CLI into a powerful terminal application

License

NotificationsYou must be signed in to change notification settings

Textualize/trogon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A picture 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 tosqlite-utils.

Screen.Recording.2023-05-20.at.12.24.35.mov

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

How it works

Trogon inspects your (command line) app and extracts aschema which describes the options / switches / help etc.It then uses that information to build aTextual UI you can use to edit and run the command.

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

Screenshots

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

Why?

Command line apps reward repeated use, but they lack indiscoverability.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 aTextual experiment, which we have been giving birds' names to.ATrogon is a beautiful bird I was lucky enough to photograph in 2017.

See alsoFrogmouth, 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

Click

  1. Importfrom trogon import tui
  2. Add the@tui decorator above your click app, e.g.
    fromtrogonimporttui@tui()@click.group(...)defcli():    ...
  3. Your click app will have a newtui command available.

Typer

  1. Importfrom trogon.typer import init_tui
  2. Pass your Typer CLI app into theinit_tui function, e.g.
    cli=typer.Typer(...)init_tui(cli)
  3. Your Typer app will have a newtui command available.

See also theexamples folder for two example apps.

Custom command name and custom help

By default the command added will be calledtui and the help text for it will beOpen Textual TUI.

You can customize one or both of these using thecommand= andhelp= parameters:

@tui(command="ui",help="Open terminal UI")@click.group(...)defcli():    ...

Follow this project

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


[8]ページ先頭

©2009-2025 Movatter.jp