[MRG + 1] Add __main__ (#159)

* Renames camelot.cli to camelot.__main__

Closes #154

* Keep __main__ and cli separate

* Monkey patch click HelpFormatter
pull/2/head
Parth P Panchal 2018-10-23 15:01:20 +05:30 committed by Vinayak Mehta
parent 60c1270745
commit 61963aabb6
3 changed files with 119 additions and 93 deletions

View File

@ -2,10 +2,20 @@
import logging
from click import HelpFormatter
from .__version__ import __version__
from .io import read_pdf
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
# set up logging
logger = logging.getLogger('camelot')

View File

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
__all__ = ('main',)
def main():
from camelot.cli import cli
cli()
if __name__ == "__main__":
main()