gh-91818: Use default program name in the CLI of many modules (GH-124867)

As argparse now detects by default when the code was run as a module.

This leads to using the actual executable name instead of simply "python"
to display in the usage message ("usage: python -m ...").
This commit is contained in:
Serhiy Storchaka 2024-10-10 00:20:53 +03:00 committed by GitHub
parent cbfd392479
commit 7d2c39752f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 14 additions and 12 deletions

View file

@ -510,7 +510,7 @@ def main():
sys.exit(1)
# Parse the arguments and options
parser = argparse.ArgumentParser(prog='python -m tokenize')
parser = argparse.ArgumentParser()
parser.add_argument(dest='filename', nargs='?',
metavar='filename.py',
help='the file to tokenize; defaults to stdin')