atlanhq / camelot

Camelot: PDF Table Extraction for Humans
https://camelot-py.readthedocs.io
Other
3.65k stars 357 forks source link

Camelot overrides click.HelpFormatter.write_usage #343

Closed dimitern closed 5 years ago

dimitern commented 5 years ago

Hey @vinayak-mehta, and thank you for making Camelot and Excalibur!

While working on adding tests for Excalibur (https://github.com/camelot-dev/excalibur/pull/49), I've noticed this code:

def _write_usage(self, prog, args='', prefix='Usage: '):
    return self._write_usage('camelot', args, prefix=prefix)

# monkey patch click.HelpFormatter
HelpFormatter._write_usage = HelpFormatter.write_usage
HelpFormatter.write_usage = _write_usage

This monkey patching causes Excalibur's (or any other click-based) CLI to return camelot for the program name in the help output, which is a bit confusing, so I decided to add this issue and propose a PR to fix it.

vinayak-mehta commented 5 years ago

Thanks for raising this issue and the corresponding PR! I didn't know about the name kwarg in click.group at the time and resorted to this monkey patch. Please give me some time to review and merge your PR.

dimitern commented 5 years ago

Closing in favour of https://github.com/camelot-dev/camelot/pull/5