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

17
home/bin/executable_inbox Normal file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
file=~/notebook/todo.xit
if [[ ! -f "$file" ]]; then
echo "$file is missing"
exit 0
fi
content=$(sed -n '/^Inbox$/,$ p' "$file" | tail -n +2)
if [[ -z "${content// }" ]]; then
echo "Inbox is empty"
else
echo "$content"
fi

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

8
home/bin/executable_todo Normal file
View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
if [[ -z "$*" ]]; then
echo "Error: Please provide a todo item"
exit 1
fi
echo "[ ] $*" >> ~/notebook/todo.xit