Browse Source

improve help

Justin Tracey 5 years ago
parent
commit
086fc21406
1 changed files with 33 additions and 12 deletions
  1. 33 12
      vice-speaker-rotator.py

+ 33 - 12
vice-speaker-rotator.py

@@ -1,6 +1,7 @@
 #!/usr/bin/env python3
 from datetime import date,timedelta
 import sys, argparse
+from argparse import RawTextHelpFormatter
 
 def str_to_date(string_date):
     return date(*[int(s) for s in string_date.split('-')])
@@ -171,41 +172,61 @@ def parse_constraintsfile(filename):
         return tweaks['c'], tweaks['p'], tweaks['h'], tweaks['n']
 
 def make_parser():
-    parser = argparse.ArgumentParser(description = \
-        'Print a speaker schedule for the CrySP weekly meetings.')
+    parser = argparse.ArgumentParser(description =
+        'Print a speaker schedule for the CrySP weekly meetings.',
+        formatter_class=RawTextHelpFormatter)
     parser.add_argument('-s', '--start',
                         metavar = 'DATE', required = True,
-                        help = 'date of the first meeting in ISO format ' +\
+                        help =
+                        'date of the first meeting in ISO format\n' +\
                         '(yyyy-mm-dd)')
     parser.add_argument('-e', '--end', metavar = 'DATE',
-                        help = 'last date to schedule a meeting on or before ' +\
+                        help =
+                        'last date to schedule a meeting on or before\n' +\
                         '(if -w also specified, uses whatever is shortest)')
     parser.add_argument('-w', '--weeks', type=int,
-                        help = 'number of weeks to schedule for ' +\
+                        help =
+                        'number of weeks to schedule for\n' +\
                         '(if -e also specified, uses whatever is shortest)')
 
     group = parser.add_mutually_exclusive_group()
     group.add_argument('-n', '--names',
                        nargs = '+', default = [], metavar = 'NAME',
-                       help = 'names to schedule in their speaking order')
+                       help =
+                       'names to schedule in their speaking order')
     group.add_argument('-f', '--namesfile',
                        metavar = 'FILE',
-                       help = 'path of a file that contains a comma-seperated' +\
+                       help =
+                       'path of a file that contains a comma-seperated\n' +\
                        ' list of names to schedule in their speaking order')
 
     parser.add_argument('-c', '--constraintsfile',
                         metavar = 'FILE',
-                        help = 'provide constraints, practice talks, and '+\
-                        'notes via supplied csv file')
+                        help =
+                        'Provide constraints, practice talks, and notes\n' +\
+                        'via supplied csv file. The CSV can contain the\n' +\
+                        'following lines:\n' +\
+                        'constraints - dates where someone cannot speak:\n' +\
+                        '"c,[name],[date1],[date2],[...]"\n' +\
+                        'notes - goes in the notes column for that date:\n' +\
+                        '"n,[date],[note]"\n' +\
+                        'practice talks - dates where something other than\n' +\
+                        'the usual CrySP meeting talks is happening:\n' +\
+                        '"p,[name],[date],[note (e.g., "practice talk")]"\n' +\
+                        'half-slot - a rare case where someone/thing needs\n' +\
+                        'only one of the speaker slots on this date:\n' +\
+                        '"h,[name],[date],[note]"\n')
 
     parser.add_argument('-r', '--no-repeat',
                         action = 'store_true',
-                        help = 'disables repeating the list of names')
+                        help =
+                        'disables repeating the list of names')
     parser.add_argument('-E', '--email',
                         nargs = '?', const = 2, default = False,
                         metavar = 'WEEKS',
-                        help = 'print an email for notifying who is speaking' +\
-                        ' the next two (or specified) weeks')
+                        help =
+                        'print an email for notifying who is speaking\n' +\
+                        'the next two (or specified) weeks')
     return parser
 
 def main(argv=None):