Proper naming and help text

This commit is contained in:
karl 2020-12-15 21:51:24 +01:00
parent ebe9548fb3
commit 5cf69dcee5

26
tx
View File

@ -33,26 +33,26 @@ def get_total(filename):
return total_time return total_time
# Parse command line arguments # Parse command line arguments
parser = argparse.ArgumentParser(prog='time.txt', description="Description") parser = argparse.ArgumentParser(prog='time.txt', description="simple plain-text time tracking.")
subparsers = parser.add_subparsers(help='sub-command help', dest='mode') subparsers = parser.add_subparsers(help='Commands', dest='mode')
parser.add_argument("-f", "--file") parser.add_argument("-f", "--file", help="a file in the time.txt format. default: ./time.txt")
# create the parser for the "a" command # create the parser for the "a" command
parser_a = subparsers.add_parser('total', help='a help') parser_total = subparsers.add_parser('total', help='print the total unbilled time. (default)')
# create the parser for the "b" command # create the parser for the "b" command
parser_b = subparsers.add_parser('add', help='b help') parser_add = subparsers.add_parser('add', help='add a time entry.')
parser_b.add_argument("date", nargs='?', default=get_current_date()) parser_add.add_argument("date", nargs='?', default=get_current_date(), help="date in the format 2020-12-30. defaults to the current date.")
parser_b.add_argument("time") parser_add.add_argument("time", help="time in the format 19:20.")
parser_b.add_argument("description") parser_add.add_argument("description", help="short description of how the time was spent.")
parser_b = subparsers.add_parser('bill', help='b help') parser_bill = subparsers.add_parser('bill', help='add a bill entry (a negative time entry).')
parser_b.add_argument("date", nargs='?', default=get_current_date()) parser_bill.add_argument("date", nargs='?', default=get_current_date(), help="date in the format 2020-12-30. defaults to the current date.")
parser_b.add_argument("time") parser_bill.add_argument("time", help="time in the format 19:20.")
parser_b.add_argument("description") parser_bill.add_argument("description", help="short description of how the time was spent.")
parser_c = subparsers.add_parser('create', help='b help') parser_create = subparsers.add_parser('create', help='create a new time.txt file.')
args = parser.parse_args() args = parser.parse_args()