Get program name from command line when invoked as package · Issue #600 · nedbat/coveragepy (original) (raw)
Originally reported by Ben Finney (Bitbucket: bignose, GitHub: bignose)
The program name, for use in the help message, is derived from the command-line arguments — except when the command-line shows the program is the main module of a package.
self.program_name = os.path.basename(sys.argv[0])
if self.program_name == '__main__.py':
self.program_name = 'coverage'
The name ‘coverage’ is hard-coded, regardless of what the package actually is.
Instead, when the command-line first argument shows the program was invoked as a package, the package name should be used for the program name.
- Bitbucket: https://bitbucket.org/ned/coveragepy/issue/600
- This issue had attachments: 0001-Get-the-command-name-from-the-file-path-of-the-first.patch. See the original issue for details.