diff --git a/home/bin/executable_inbox b/home/bin/executable_inbox new file mode 100644 index 0000000..c902603 --- /dev/null +++ b/home/bin/executable_inbox @@ -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 + diff --git a/home/bin/executable_nb b/home/bin/executable_nb new file mode 100644 index 0000000..5fcfbce --- /dev/null +++ b/home/bin/executable_nb @@ -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 + +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 diff --git a/home/bin/executable_todo b/home/bin/executable_todo new file mode 100644 index 0000000..2a173d3 --- /dev/null +++ b/home/bin/executable_todo @@ -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