Skip to content

Commit

Permalink
Add docstring for main.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Aug 16, 2024
1 parent c900786 commit 547cec6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions jaraco/ui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@


def main(func, app=typer.Typer(add_completion=False)):
"""
Decorator and wrapper around typer to mark a function as main.
For example:
@main
def run(...):
...
Use of this decorator outside of the same module will not have
the intended effect.
"""
if named.get_module(func) == '__main__':
app.command()(func)
app()
Expand Down

0 comments on commit 547cec6

Please sign in to comment.