click: Windows "Usage" incorrect display and difficulty to get a command name correct displayed
When you create a command with a setuptools console_scripts entry_points (for instance named mycli) the Usage displayed on POSIX (Linux, Mac,…) when running mycli --help will be:
Usage: mycli
In contrast on Windows, I get the following:
Usage: mycli-script.py
This is annoying because the correct invocation on windows is to use mycli, not mycli-script.py. The script is the same on all OSes, even though behind the scenes setuptools creates:
- on posix, a bin/mycli python script with a correct shebang
- on windows, a Scripts/mycli-script.py and Scripts/mycli.exe. This is called by invoking mycli like on POSIX
The obvious way to force this would be to use the name arg in click.command. (“This defaults to the function name.”). But it does not default to the function name and always show the mycli-script.py instead of mycli.
It looks like this comes from Context.info_name which is computed somehow, but I could not find a way to get this info_name forced to something fixed.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 25 (19 by maintainers)
Commits related to this issue
- Potential fix for issue #4 * workaround https://github.com/mitsuhiko/click/issues/365 by suclassing click.Command.main() to force the prog_name to self.name. * also refactored the usage displ... — committed to nexB/scancode-toolkit by pombredanne 9 years ago
- Minimal workaround click 4.0 bug https://github.com/mitsuhiko/click/issues/365 — committed to nexB/aboutcode-toolkit by pombredanne 9 years ago
Fixed in latest version of setuptools (*_^)/
This should be fixed soon: pypa/setuptools/pull/736 pypa/pip/pull/3918