Add mode argument, default 'total'

This commit is contained in:
karl 2020-12-15 00:34:52 +01:00
parent 59722e19a2
commit 20a66b8f48

5
tx
View File

@ -8,6 +8,10 @@ parser = argparse.ArgumentParser(description="Description")
# add arguments to the parser # add arguments to the parser
parser.add_argument("-f", "--file") parser.add_argument("-f", "--file")
parser.add_argument("mode",
help="display the square of a given number",
nargs='?', default="total",
choices=["total"])
args = parser.parse_args() args = parser.parse_args()
@ -16,6 +20,7 @@ if args.file:
else: else:
time_file = open('time.txt','r') time_file = open('time.txt','r')
if args.mode == "total":
total_time = timedelta() total_time = timedelta()
for line in time_file: for line in time_file: