added aoc

This commit is contained in:
Antoine 2024-12-04 13:32:40 +01:00
parent 1c775e4a19
commit 31310f9d5f

View file

@ -5,6 +5,8 @@ today=$(date +%d-%m-%Y)
daily_note_dir="$NOTES_DIR/daily_notes" daily_note_dir="$NOTES_DIR/daily_notes"
today_file="${daily_note_dir}/${today}_daily.md" today_file="${daily_note_dir}/${today}_daily.md"
most_recent_file=$(ls -t ${daily_note_dir}/*_daily.md | head -n 1) most_recent_file=$(ls -t ${daily_note_dir}/*_daily.md | head -n 1)
month=$(date +%m)
day=$(date +%d)
# Function to find unticked checkboxes in the most recent daily note # Function to find unticked checkboxes in the most recent daily note
find_unticked_checkboxes() { find_unticked_checkboxes() {
@ -15,6 +17,13 @@ find_unticked_checkboxes() {
fi fi
} }
# Function to add aoc checkbox if it's December before the 24th
add_aoc_checkbox() {
if [[ "$month" -eq "12" && "$day" -lt "25" ]]; then
echo "- [ ] Advent of Code"
fi
}
# Check if today's daily note exists # Check if today's daily note exists
if [[ -f "$today_file" ]]; then if [[ -f "$today_file" ]]; then
echo "Today's daily note already exists. Opening with neovim..." echo "Today's daily note already exists. Opening with neovim..."
@ -28,6 +37,7 @@ else
echo "---" echo "---"
echo "# To-Do" echo "# To-Do"
find_unticked_checkboxes find_unticked_checkboxes
add_aoc_checkbox
# echo "- [ ]" # echo "- [ ]"
echo "" echo ""
echo "# Logbook" echo "# Logbook"