Textualize / trogon

Easily turn your Click CLI into a powerful terminal application
MIT License
2.5k stars 54 forks source link

Trouble adding trogon TUI to typer app #94

Closed peterjc closed 1 week ago

peterjc commented 3 weeks ago

I tried the documented approach with init_tui, but couldn't get it to add tui to the command.

However adding this did work (spotted somewhere on the issue tracker, I lost the link though):

@app.command()
def tui(ctx: typer.Context):
    from typer.main import get_group
    from trogon import Trogon
    Trogon(get_group(app), click_context=ctx).run()

Using typer 0.12.5, trogon 0.6.0, Python 3.12, macOS

Perhaps a typer example under examples/ would help?

daneah commented 1 week ago

Thanks for reporting @peterjc; can you see if #96 helps you resolve this or if you're still having challenges with it?

peterjc commented 1 week ago

That did work for me, thank you.

Sadly I don't think I kept my earlier attempts to work out what I was doing wrong in hindsight.

daneah commented 1 week ago

@peterjc no worries, glad to hear it's working for you!