Replies: 1 comment
-
As in Lucretiel/autocommand#37, we might use |
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
-
First Check
Note, searching for
__name__
or__main__
in GitHub is ineffective, so a I scanned through issues, but couldn't land on a good search methodology.Commit to Help
Example Code
Description
In autocommand, the "hello world" is three lines shorter than the same for typer, because it allows a function to be decorated as "the command". Because autocommand is abandoned, I'm considering replacing it with typer. I'd like, however, not to add all of this boilerplate to each of my command scripts. I'd much rather typer provide a decorator that either:
__name__
parameter and does the== "__main__"
check, or__name__
is also unnecessary.Imagine, something like:
Where
autorun
figures out its call scope, inspects thef_globals['__name__']
and runs the command if it equals__main__
.This one change would go a long way to making typer a suitable replacement for autocommand.
Operating System
Other
Operating System Details
No response
Typer Version
n/a
Python Version
n/a
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions