Created
January 19, 2022 11:18
-
-
Save bbelderbos/d55172fe65cfc3087430b0fad3bc8776 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
The wins file generator script we use at PyBites | |
Because it matters! | |
https://pybit.es/articles/boost-your-motivation-with-brag-doc/ | |
""" | |
from datetime import date, datetime | |
import sys | |
LAST_WEEK_NUMBER = 52 | |
WINS_HEADER = """# Wins of the Week | |
""" | |
# update this template to your liking | |
WEEKLY_WINS = """## {week} | |
* Work / business: | |
* | |
* | |
* Health: | |
* | |
* | |
* Family: | |
* | |
* | |
* Learning: | |
* | |
* | |
""" | |
def generate_wins_md(week_numbers): | |
print(WINS_HEADER) | |
for week in week_numbers: | |
print(WEEKLY_WINS.format(week=f"Week {week}")) | |
def _get_start_date(): | |
start_date = date.today() | |
if len(sys.argv) > 1: | |
try: | |
start_date = datetime.strptime(sys.argv[1], '%Y-%m-%d') | |
except ValueError: | |
print("Please enter a valid date: YYYY-MM-DD") | |
sys.exit(1) | |
return start_date | |
def main(): | |
start_date = _get_start_date() | |
start_week_number = start_date.isocalendar()[1] | |
week_numbers = range(start_week_number, LAST_WEEK_NUMBER + 1) | |
generate_wins_md(week_numbers) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment