I want to add the command "help" to my CLI (as a command and not an option) #833
Answered
by
ismailbenhallam
ismailbenhallam
asked this question in
Questions
-
First Check
Commit to Help
Example Codeimport typer
app = typer.Typer()
@app.command(name="help")
def additional_help(ctx: typer.Context):
print(ctx.help())
if __name__ == "__main__":
app() DescriptionI expect to have a way to get the generated help for all commands (using --help) from the typer.Context Operating SystemmacOS Operating System DetailsNo response Typer Version0.12.3 Python Version3.11.8 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Answered by
ismailbenhallam
May 25, 2024
Replies: 1 comment 2 replies
-
You have to add a second command, as if there is only one, you will not have to do |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I finally figured it out.
When I did this:
I was getting the help for this command which is "help".
So I had to go back one level (using
context.parent
) to get what I needed: