Coder Social home page Coder Social logo

trogon's Introduction

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 to sqlite-utils.

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

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

How it works

Trogon inspects your (command line) app and extracts a schema which describes the options / switches / help etc. It then uses that information to build a Textual 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 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 experiment, 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.

Custom command name and custom help

By default the command added will be called tui and the help text for it will be Open Textual TUI.

You can customize one or both of these using the help= and command= parameters:

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

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.

trogon's People

Contributors

darrenburns avatar willmcgugan avatar simonw avatar aradhya-tripathi avatar kianmeng avatar figsoda avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.