added custom start-date to quarantine-day-counter
This commit is contained in:
parent
c736258ce1
commit
7ab9bd207d
@ -19,6 +19,11 @@ quarantine_start_date = "13 Mar 2020"
|
||||
|
||||
def parse_args():
|
||||
argp = argparse.ArgumentParser()
|
||||
argp.add_argument(
|
||||
'-s', '--start-date',
|
||||
default=quarantine_start_date,
|
||||
help="Different start date than the original (%(default)s)"
|
||||
)
|
||||
return argp.parse_args()
|
||||
|
||||
def quarantine_days(quarantine_start_date=quarantine_start_date):
|
||||
@ -27,13 +32,14 @@ def quarantine_days(quarantine_start_date=quarantine_start_date):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# args = parse_args()
|
||||
args = parse_args()
|
||||
|
||||
try:
|
||||
start_date_message = f"\nQuarantine Start Date: {color.yellow(quarantine_start_date)}"
|
||||
quarantine_days_message = f"Quarantine Days: {color.red(quarantine_days(quarantine_start_date))}"
|
||||
start_date_message = f"\nQuarantine Start Date: {color.yellow(args.start_date)}"
|
||||
quarantine_days_message = f"Quarantine Days: {color.red(quarantine_days(args.start_date))}"
|
||||
except NameError:
|
||||
start_date_message = f"\nQuarantine Start Date: {quarantine_start_date}"
|
||||
quarantine_days_message = f"Quarantine Days: {quarantine_days(quarantine_start_date)}"
|
||||
start_date_message = f"\nQuarantine Start Date: {args.start_date}"
|
||||
quarantine_days_message = f"Quarantine Days: {quarantine_days(args.start_date)}"
|
||||
|
||||
print(start_date_message)
|
||||
print(quarantine_days_message)
|
||||
|
Loading…
Reference in New Issue
Block a user