click detects program name when run as module

This commit is contained in:
David Lord 2021-01-29 11:29:36 -08:00
parent 64206c13c2
commit 055cdc2625
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
2 changed files with 4 additions and 4 deletions

View file

@ -1,3 +1,3 @@
from .cli import main
main(as_module=True)
main()

View file

@ -953,10 +953,10 @@ debug mode.
)
def main(as_module=False):
def main():
# TODO omit sys.argv once https://github.com/pallets/click/issues/536 is fixed
cli.main(args=sys.argv[1:], prog_name="python -m flask" if as_module else None)
cli.main(args=sys.argv[1:])
if __name__ == "__main__":
main(as_module=True)
main()