-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for typer applications #51
Comments
import typer
from click_man.core import write_man_pages
from cli import app, __version__
def make_man():
'''Generates man pages for the CLI'''
cli = typer.main.get_command(app)
name = 'cli'
version = __version__
target_dir = './man'
write_man_pages(name, cli, version=version, target_dir=target_dir)
return That code snippet seems to work just fine to generate man pages for my typer CLI |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Typer is a CLI python package built on click, so it stands to reason that this project should work just fine with CLIs built with typer.
Here's the output of the command to generate man pages :
The entry point points to a
typer.Typer
instance. The click object can be fetched usingtyper.main.get_command(app: typer.Typer)
, which should make it trivial to make the app work.I've tried to make it work myself :
typer.main.get_command(app)
where app is mytyper.Typer()
instance to a variablepoetry run click-man --target ./man my-cli
on itI may try to import click-man in my poetry scripts and run it using
poetry run gen-man
or something, in order to make it work, but having typer support out of the box would be great.The text was updated successfully, but these errors were encountered: