Mercurial > hg > bitsyblog
comparison bitsyblog/blogme.py @ 67:894a2e76bd40
add documentation to the OptionParser
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 20 Apr 2010 20:01:46 -0700 |
parents | 4e41e1084e56 |
children | 3da163e44b8a |
comparison
equal
deleted
inserted
replaced
65:4e41e1084e56 | 67:894a2e76bd40 |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | |
3 """ | 2 """ |
4 command line blogger | 3 command line blogger |
5 """ | 4 """ |
6 | 5 |
7 import optparse | 6 import optparse |
30 return buffer | 29 return buffer |
31 | 30 |
32 def main(args=sys.argv[1:]): | 31 def main(args=sys.argv[1:]): |
33 | 32 |
34 # parse command line options | 33 # parse command line options |
35 parser = optparse.OptionParser() | 34 parser = optparse.OptionParser(description=__doc__) |
36 parser.add_option('-c', '--config') | 35 parser.add_option('-c', '--config', |
37 parser.add_option('-f', '--file') | 36 help='configuration file to use [Default: ~/.blogme]') |
38 parser.add_option('-H', '--host') | 37 parser.add_option('-f', '--file', |
38 help='path to blog entries for the user; does not touch net') | |
39 parser.add_option('-H', '--host', | |
40 help='URL of bitsyblog instance') | |
39 parser.add_option('-u', '--user') | 41 parser.add_option('-u', '--user') |
40 parser.add_option('-p', '--password') | 42 parser.add_option('-p', '--password') |
41 parser.add_option('--private', action='store_true', default=False) | 43 parser.add_option('--private', action='store_true', default=False, |
42 parser.add_option('--secret', action='store_true', default=False) | 44 help='denote this blog entry as private') |
45 parser.add_option('--secret', action='store_true', default=False, | |
46 help='denote this blog entry as secret') | |
43 options, args = parser.parse_args() | 47 options, args = parser.parse_args() |
44 | 48 |
45 # sanity check | 49 # sanity check |
46 if options.private and options.secret: | 50 if options.private and options.secret: |
47 print "post can't be secret and private!" | 51 print "post can't be secret and private!" |