Mercurial > hg > PaInt
comparison paint/main.py @ 1:a011af5e765a
spacing
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Tue, 21 Feb 2012 20:56:02 -0800 |
| parents | 96362e527bd6 |
| children | 4be44827e436 |
comparison
equal
deleted
inserted
replaced
| 0:96362e527bd6 | 1:a011af5e765a |
|---|---|
| 7 import sys | 7 import sys |
| 8 import optparse | 8 import optparse |
| 9 | 9 |
| 10 def main(args=sys.argv[:]): | 10 def main(args=sys.argv[:]): |
| 11 | 11 |
| 12 # parse command line options | 12 # parse command line options |
| 13 usage = '%prog [options]' | 13 usage = '%prog [options]' |
| 14 | 14 |
| 15 # description formatter | 15 # description formatter |
| 16 class PlainDescriptionFormatter(optparse.IndentedHelpFormatter): | 16 class PlainDescriptionFormatter(optparse.IndentedHelpFormatter): |
| 17 def format_description(self, description): | 17 def format_description(self, description): |
| 18 if description: | 18 if description: |
| 19 return description + '\n' | 19 return description + '\n' |
| 20 else: | 20 else: |
| 21 return '' | 21 return '' |
| 22 | 22 |
| 23 parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter()) | 23 parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter()) |
| 24 options, args = parser.parse_args(args) | 24 options, args = parser.parse_args(args) |
| 25 | 25 |
| 26 if __name__ == '__main__': | 26 if __name__ == '__main__': |
| 27 main() | 27 main() |
| 28 |
