feat(user/malte): improve notetaking script

This commit is contained in:
Malte Tammena 2024-03-03 11:12:28 +01:00
parent d47679ec28
commit 2f67e8d8d5
2 changed files with 12 additions and 1 deletions

View file

@ -15,7 +15,17 @@ year="$(date +%Y)"
# Just start helix if no arguments are given
if [ -z "${1+x}" ]; then
hx "$XDG_DATA_HOME/life.md/$year.md" +99999
# Switch directory
pushd "$XDG_DATA_HOME/life.md" || exit 1
# Open Helix with the current year
hx "$year.md" +99999
# Commit changes if any exist
if ! git diff --quiet "$year.md"; then
git add "$year.md"
git commit -m "Auto Commit $(date +"%F %R")"
fi
# Exit
popd || exit 2
exit
fi

View file

@ -7,6 +7,7 @@
pkgs.marksman
pkgs.ripgrep
pkgs.ncurses
pkgs.git
];
text = builtins.readFile ../../scripts/note.sh;
};