123456789101112131415161718192021222324252627282930313233 |
- #!/usr/bin/env python
- # PYTHON_ARGCOMPLETE_OK
- import sys
- import dingguo.parser.ingdiba
- def compute(file):
-
- sys.stdout.write(dingguo.parser.ingdiba.ingdiba_pdf_file_to_text(file).encode('utf-8'))
- def _init_argparser():
- import argparse
- argparser = argparse.ArgumentParser(description = None)
- argparser.add_argument('file', type = argparse.FileType('rb'))
- return argparser
- def main(argv):
- argparser = _init_argparser()
- try:
- import argcomplete
- argcomplete.autocomplete(argparser)
- except ImportError:
- pass
- args = argparser.parse_args(argv)
- compute(**vars(args))
- return 0
- if __name__ == "__main__":
- sys.exit(main(sys.argv[1:]))
|