changeset 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 3550159184cf
files bitsyblog/blogme.py
diffstat 1 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/bitsyblog/blogme.py	Tue Apr 13 13:59:43 2010 -0700
+++ b/bitsyblog/blogme.py	Tue Apr 20 20:01:46 2010 -0700
@@ -1,5 +1,4 @@
 #!/usr/bin/env python
-
 """
 command line blogger
 """
@@ -32,14 +31,19 @@
 def main(args=sys.argv[1:]):
 
     # parse command line options
-    parser = optparse.OptionParser()
-    parser.add_option('-c', '--config')
-    parser.add_option('-f', '--file')
-    parser.add_option('-H', '--host')
+    parser = optparse.OptionParser(description=__doc__)
+    parser.add_option('-c', '--config',
+                      help='configuration file to use [Default: ~/.blogme]')
+    parser.add_option('-f', '--file',
+                      help='path to blog entries for the user; does not touch net')
+    parser.add_option('-H', '--host',
+                      help='URL of bitsyblog instance')
     parser.add_option('-u', '--user')
     parser.add_option('-p', '--password')
-    parser.add_option('--private', action='store_true', default=False)
-    parser.add_option('--secret', action='store_true', default=False)
+    parser.add_option('--private', action='store_true', default=False,
+                      help='denote this blog entry as private')
+    parser.add_option('--secret', action='store_true', default=False,
+                      help='denote this blog entry as secret')
     options, args = parser.parse_args()
     
     # sanity check