Replies: 1 comment
-
|
You can also specify it as a app = typer.Typer(result_callback=tear_down) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Thanks for the amazing library! I have a suggestion about result callbacks.
Currently, if you want to have a callback after a command, you can use the
result_callbackargument of@app.callback. This is not described in the doc and a bit of a hidden feature. Consider the following:It works but the interface could look clearer. I am confused that the result callback has to be defined with the callback.
I would prefer to have either a dedicated
@app.resultcallback(as click does). Or a parameter on callback@app.callback(result_callback=True). But I would definitely dissociate both callback definitions from each other.Also, IMO this should be documented in the callback section of the doc. I was looking into this for a proper way to setup and close DB connections.
Beta Was this translation helpful? Give feedback.
All reactions