tomwhite / covid-19-uk-data

Coronavirus (COVID-19) UK Historical Data
http://tom-e-white.com/covid-19-uk-data/
The Unlicense
162 stars 79 forks source link

Use today's date by default #12

Closed gitmapd closed 4 years ago

gitmapd commented 4 years ago

You say in your TODO you want to add a default date. Why not adding an argument parser and add a calculation for a date instead of using sys.argv[i]?

tomwhite commented 4 years ago

This would be a useful improvement. Currently DATE is defined as a bash variable so it can be used in the git commit message (see https://github.com/tomwhite/covid-19-uk-data#daily-workflow), so I'm not sure the best way to keep these consistent.

gitmapd commented 4 years ago

I'd try this parser.add_argument("-s", "--start-date", dest="date", default=date.today() - timedelta(days = 1), type=lambda d: datetime.strptime(d, '%Y%m%d').date(), help="Date in the format yyyymmdd") You could then call the argument directly at the end with the date variable

tomwhite commented 4 years ago

I fixed this by creating a little wrapper script (update.sh).