annotate paint/main.py @ 0:96362e527bd6

initial package
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 21 Feb 2012 20:30:10 -0800
parents
children a011af5e765a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 #!/usr/bin/env python
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3 """
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4 python PAckage INTrospection
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5 """
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
6
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7 import sys
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8 import optparse
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
10 def main(args=sys.argv[:]):
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
11
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
12 # parse command line options
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
13 usage = '%prog [options]'
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
14
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
15 # description formatter
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
16 class PlainDescriptionFormatter(optparse.IndentedHelpFormatter):
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
17 def format_description(self, description):
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
18 if description:
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
19 return description + '\n'
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
20 else:
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
21 return ''
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
22
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
23 parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter())
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
24 options, args = parser.parse_args(args)
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
25
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
26 if __name__ == '__main__':
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
27 main()
96362e527bd6 initial package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
28