Mercurial > hg > TextShaper
view textshaper/main.py @ 1:92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Sat, 10 Aug 2013 22:00:50 -0700 |
parents | 53cfd6e1ad0f |
children | 925a7959cd0b |
line wrap: on
line source
#!/usr/bin/env python # -*- coding: utf-8 -*- """ package to shape text blocks """ import optparse import os import subprocess import sys def add_options(parser): """add options to the OptionParser instance""" def main(args=sys.argv[1:]): # parse command line options usage = '%prog [options] ...' class PlainDescriptionFormatter(optparse.IndentedHelpFormatter): """description formatter for console script entry point""" def format_description(self, description): if description: return description.strip() + '\n' else: return '' parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter()) options, args = parser.parse_args(args) if __name__ == '__main__': main()