A simple tool to create dates in a date range at the terminal. Each date in the date range is printed to the screen allowing for redirection or incorporation into other command line tools.

# /// script
# dependencies = [
# "click",
# ]
# ///
from datetime import timedelta
import click
@click.command()
@click.option('--start_date', type=click.DateTime(formats=["%Y-%m-%d"]), required=True, help='Start date in YYYY-MM-DD format.')
@click.option('--end_date', type=click.DateTime(formats=["%Y-%m-%d"]), required=True, help='End date in YYYY-MM-DD format.')
def generate_dates(start_date, end_date):
"""Generate a list of dates between start_date and end_date (inclusive)."""
current_date = start_date
while current_date <= end_date:
print(current_date.strftime("%Y-%m-%d"))
current_date += timedelta(days=1)
if __name__ == '__main__':
generate_dates()