From 7d07c5fb2b4fa90fc35f36d8bc3d6197c6947037 Mon Sep 17 00:00:00 2001 From: GitMatt Date: Sun, 9 Feb 2025 08:37:15 -0800 Subject: [PATCH] add better template. --- CHANGELOG.md | 10 ++++++++ plan.bak | 44 ------------------------------------ src/plan/__init__.py | 24 ++++++++++++++++++++ src/plan/cli.py | 2 +- src/plan/path.py | 24 -------------------- src/plan/templates/plan.html | 38 +++++++++++++++++++++++++++---- 6 files changed, 69 insertions(+), 73 deletions(-) create mode 100644 CHANGELOG.md delete mode 100755 plan.bak delete mode 100644 src/plan/path.py diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..5e0471d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ +# changelog + +## 0.1.1 - 2025-01-18 + +### added + +- git tags. +- readme install instructions. +- added changelog. +- more templates: schedule, buy. diff --git a/plan.bak b/plan.bak deleted file mode 100755 index d4cf9c8..0000000 --- a/plan.bak +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -cd ~/.plan || { - echo "Directory ~/.plan not found" - exit 1 -} - -# YYYY-MM-DD format -today=$(date +%F) - -# create if None -if ! ls "$today.md" >/dev/null 2>&1; then - touch "$today.md" - { - printf "# %s\n\n" "$today" - printf "# todo\n\n" - # todo - - - chore: shred documents. - - workout: ymca. - - buy: soda stream. - - donate: table - - hang: painting - - code: - - # meals - - - breakfast: oatmeal - - lunch: leftovers - - dinner: curry - - # groceries - - } >>"$today.md" -fi - -# most recently modified -recent_file=$(ls -t *.md | head -n 1) -if [[ "$recent_file" != "$today.md" ]]; then - recent_file="$today.md" -fi - -# Open the most recent file in Neovim and run the command -nvim "$recent_file" +":normal \" diff --git a/src/plan/__init__.py b/src/plan/__init__.py index e69de29..d03627d 100644 --- a/src/plan/__init__.py +++ b/src/plan/__init__.py @@ -0,0 +1,24 @@ +import os +from datetime import datetime +from pathlib import Path + +from .templates import default + + +def today() -> Path: + today = datetime.today().strftime("%Y-%m-%d") + today_path = Path().home() / ".plan" / f"{today}.md" + return today_path + + +def open(plan: Path): + import subprocess + + plan.parent.mkdir(parents=True, exist_ok=True) + if not plan.exists(): + plan.touch() + with plan.open("w") as f: + f.write(default()) + editor = os.getenv("EDITOR", "nvim") + os.chdir(Path().home() / ".plan") + subprocess.run([editor, str(plan)]) diff --git a/src/plan/cli.py b/src/plan/cli.py index eddc106..7c3815f 100644 --- a/src/plan/cli.py +++ b/src/plan/cli.py @@ -1,6 +1,6 @@ import click from click_default_group import DefaultGroup -from .path import open, today +from . import open, today @click.group(cls=DefaultGroup, default="today", default_if_no_args=True) diff --git a/src/plan/path.py b/src/plan/path.py deleted file mode 100644 index d03627d..0000000 --- a/src/plan/path.py +++ /dev/null @@ -1,24 +0,0 @@ -import os -from datetime import datetime -from pathlib import Path - -from .templates import default - - -def today() -> Path: - today = datetime.today().strftime("%Y-%m-%d") - today_path = Path().home() / ".plan" / f"{today}.md" - return today_path - - -def open(plan: Path): - import subprocess - - plan.parent.mkdir(parents=True, exist_ok=True) - if not plan.exists(): - plan.touch() - with plan.open("w") as f: - f.write(default()) - editor = os.getenv("EDITOR", "nvim") - os.chdir(Path().home() / ".plan") - subprocess.run([editor, str(plan)]) diff --git a/src/plan/templates/plan.html b/src/plan/templates/plan.html index 0f3d938..3b02b57 100644 --- a/src/plan/templates/plan.html +++ b/src/plan/templates/plan.html @@ -6,6 +6,7 @@ - workout: - job: - comm: +- buy: ## meals @@ -13,9 +14,38 @@ - lunch: leftovers - dinner: curry +## schedule + +- 5:00: sleep. +- 6:00: breakfast. +- 7:00: walk. +- 8:00: meeting. +- 9:00: code. +- 10:00: code. +- 11:00: walk. +- 12:00: lunch. +- 1:00: code. +- 2:00: code. +- 3:00: walk. +- 4:00: code. +- 5:30: trailhead. +- 6:00: cook. +- 7:00: dinner. +- 8:00: wind down. +- 9:00: read. +- 10:00: sleep. + ## groceries -- lx -- spinach -- apples -- bananas +- milk. +- oatmeal. +- lx. +- passionfruit. +- spinach. +- bananas. +- chicken. +- crackers. +- cheese. +- apples. +- bread. +