Created
September 6, 2023 13:35
-
-
Save marcstreeter/2eaa8ae94c58f953ce7df852ee8d846c to your computer and use it in GitHub Desktop.
This will display help for scripts with just one command but that are called with no commands.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import typer | |
app = typer.Typer() | |
@app.callback(invoke_without_command=True) | |
def default(ctx: typer.Context): | |
typer.echo(ctx.get_help()) | |
@app.command() | |
def trigger(): | |
"""calls trigger""" | |
print("work done here") | |
if __name__ == "__main__": | |
app() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment