Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- """Checks a given DocBook XML file for stylistic errors
- Usage:
- sdsc [-h | --help]
- sdsc [options] INPUTFILE [OUTPUTFILE]
- Required arguments:
- INPUTFILE the DocBook XML file to check for
- OUTPUTFILE optional result file or stdout
- Options:
- -h, --help show this help message and exit
- --version show version number and exit
- -b, --bookmarklet open Web page that lets you install a bookmarklet to
- manage style checker results
- -s, --show show final report in $BROWSER, or default browser if
- unset; not all browsers open report files correctly and
- for some users, a text editor will open; in such cases,
- set the BROWSER variable with: export BROWSER=/MY/BROWSER;
- Chromium or Firefox will both do the right thing
- --module writes name of current check module to stdout
- --performance write performance measurements to stdout
- --checkpatterns check formal validity of built-in regular expression
- patterns
- """
- from docopt import docopt
- __proc__ = "sdsc"
- __version__ = "1.0.0"
- def parsecli(cliargs=None):
- """Parse CLI arguments with docopt
- :param list cliargs: List of commandline arguments
- :return: dictionary from docopt
- :rtype: dict
- """
- version = "%s %s" % (__package__, __version__)
- args = docopt(__doc__, argv=cliargs, version=version)
- return args
- if __name__ == "__main__":
- args = parsecli()
- print(args)
- # ./sdsc_docopt.py foo.xml
- # {'--bookmarklet': False,
- # '--checkpatterns': False,
- # '--help': False,
- # '--module': False,
- # '--performance': False,
- # '--show': False,
- # '--version': False,
- # 'INPUTFILE': 'foo.xml',
- # 'OUTPUTFILE': None}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement