misc helper scripts

This commit is contained in:
Matthew Ryan Dillon 2025-12-14 16:20:35 -05:00
parent 16cf71e592
commit 00b0b76637
3 changed files with 78 additions and 0 deletions

53
home/bin/executable_nb Normal file
View file

@ -0,0 +1,53 @@
#!/usr/bin/env bash
NOTEBOOK_DIR=~/notebook
if [[ ! -d "$NOTEBOOK_DIR" ]]; then
echo "Error: Notebook directory does not exist at $NOTEBOOK_DIR"
exit 1
fi
cd "$NOTEBOOK_DIR" || exit 1
show_help() {
cat << EOF
nb - Notebook management tool
Usage: nb <command>
Commands:
save Commit changes with timestamp
sync Save, fetch, and push changes
log Show commit log
diff Show differences
status Show diff summary
EOF
}
case "$1" in
save)
jj diff -r @ --summary | grep -q . && jj commit -m "$(date +"%Y-%m-%dT%H:%M:%S%z")" && jj tug || true
;;
sync)
"$0" save && jj git fetch && jj git push
;;
log)
jj log -r ".."
;;
diff)
jj diff
;;
status)
jj diff -s
;;
"")
show_help
;;
*)
echo "Error: Unknown command '$1'"
echo ""
show_help
exit 1
;;
esac