summaryrefslogtreecommitdiff
path: root/mac/.local/bin
diff options
context:
space:
mode:
Diffstat (limited to 'mac/.local/bin')
-rwxr-xr-xmac/.local/bin/fzffiles2
-rwxr-xr-xmac/.local/bin/hugow54
-rwxr-xr-xmac/.local/bin/ppts123
3 files changed, 151 insertions, 28 deletions
diff --git a/mac/.local/bin/fzffiles b/mac/.local/bin/fzffiles
index 44634a2..97047e9 100755
--- a/mac/.local/bin/fzffiles
+++ b/mac/.local/bin/fzffiles
@@ -53,7 +53,7 @@ files=$(fzf-tmux \
--bind "ctrl-g:change-prompt(  )+reload(fd -H -L -t f -E .Trash -E .git -E .cache . $HOME/Private/repos $HOME/Public/repos)" \
--bind "ctrl-h:change-prompt( 🏠 )+reload(fd -H -L -t f -E .Trash -E .git -E .cache . $HOME)" \
--bind "ctrl-k:change-prompt( 🖥️ )+reload(fd -H -L -t f -E .Trash -E .git -E .cache . ${XDG_DESKTOP_DIR:-${HOME}/Desktop})" \
- --bind "ctrl-r:change-prompt( 👟 )+reload(fd -H -L -t f -E .Trash -E .git -E .cache -E zsh . ${XDG_BIN_HOME:-${HOME}/.local/bin})" \
+ --bind "ctrl-r:change-prompt( 👟 )+reload(fd -H -L -t f -E .Trash -E .git -E .cache -E zsh . ${XDG_SCRIPTS_HOME:-${HOME}/.local/bin})" \
--bind "ctrl-s:change-prompt( 🛠 )+reload(find ${XDG_SOURCES_HOME:-${HOME}/.local/src}/suckless -maxdepth 2 -type f -not -path '*/.git/*')" \
--bind "ctrl-u:change-prompt( 📝 )+reload(if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then top=\$(git rev-parse --show-toplevel 2>/dev/null); git -C \"\$top\" status --porcelain | awk -v root=\"\$top\" '{
staged=substr(\$0,1,1);
diff --git a/mac/.local/bin/hugow b/mac/.local/bin/hugow
index 0460174..e9113a0 100755
--- a/mac/.local/bin/hugow
+++ b/mac/.local/bin/hugow
@@ -18,33 +18,33 @@ fi
tmp="$(mktemp "$out.XXXXXXXX.tmp")"
-awk -v defaults="$defaults" '
-BEGIN {
- n = split(defaults, a, /[[:space:]]+/)
- insert = ""
- for (i = 1; i <= n; i++) {
- if (a[i] == "") continue
- name = a[i] ".mp4"
- insert = insert \
-" <li>\n" \
-" <a href=\"/recordings/" name "\" data-name=\"" name "\" class=\"vid\">" name "</a>\n" \
-" </li>\n"
- }
- injected = 0
-}
-{
- print
- if (!injected && $0 ~ /<ul[^>]*id=["'\''"]list["'\''"][^>]*>/) {
- printf("%s", insert)
- injected = 1
- }
-}
-END { if (!injected) exit 2 }
-' "$out" >"$tmp"
-
-mv "$tmp" "$out"
-echo "Injected defaults into: $out"
-
+# awk -v defaults="$defaults" '
+# BEGIN {
+# n = split(defaults, a, /[[:space:]]+/)
+# insert = ""
+# for (i = 1; i <= n; i++) {
+# if (a[i] == "") continue
+# name = a[i] ".mp4"
+# insert = insert \
+# " <li>\n" \
+# " <a href=\"/recordings/" name "\" data-name=\"" name "\" class=\"vid\">" name "</a>\n" \
+# " </li>\n"
+# }
+# injected = 0
+# }
+# {
+# print
+# if (!injected && $0 ~ /<ul[^>]*id=["'\''"]list["'\''"][^>]*>/) {
+# printf("%s", insert)
+# injected = 1
+# }
+# }
+# END { if (!injected) exit 2 }
+# ' "$out" >"$tmp"
+#
+# mv "$tmp" "$out"
+# echo "Injected defaults into: $out"
+#
ssh "$server" "mkdir -p '$dest'"
if [ -n "${THESIAH_SSH_OPTS:-}" ]; then
diff --git a/mac/.local/bin/ppts b/mac/.local/bin/ppts
new file mode 100755
index 0000000..e315367
--- /dev/null
+++ b/mac/.local/bin/ppts
@@ -0,0 +1,123 @@
+#!/bin/sh
+
+# Auto workflow script for git push with content/ directory handling
+# Usage: ppts
+# Automatically: git add ., commit without content/, push to origin, then add content/ and push to home
+
+# Always cd to THESIAH repository
+THESIAH_REPO="${THESIAH_WWW:-${HOME}/Private/repos/THESIAH}"
+
+if [ ! -d "$THESIAH_REPO" ]; then
+ echo "Error: THESIAH repository not found at $THESIAH_REPO"
+ exit 1
+fi
+cd "$THESIAH_REPO" || exit 1
+
+# Verify this is the correct git repository
+if ! git rev-parse --git-dir >/dev/null 2>&1; then
+ echo "Error: Not a git repository at $THESIAH_REPO"
+ exit 1
+fi
+
+# If no arguments, run auto workflow
+if [ -z "$1" ]; then
+ echo "Running auto workflow..."
+
+ # Step 0: Stage all changes first
+ echo "Step 0: Staging all changes..."
+ git add .
+
+ # Check if there are any changes to commit
+ if git diff --quiet && git diff --cached --quiet; then
+ echo "No changes to commit"
+ exit 0
+ fi
+
+ # Step 1: Unstage content/ from staging
+ echo "Step 1: Excluding content/ from staging..."
+ git reset content/ 2>/dev/null || true
+
+ # Check if there are changes to commit (excluding content/)
+ has_changes_without_content=false
+ if ! git diff --cached --quiet; then
+ has_changes_without_content=true
+ fi
+
+ # Check if content/ has changes
+ has_content_changes=false
+ if [ -d "content/" ]; then
+ # Check for untracked files in content/
+ if [ -n "$(git ls-files --others --exclude-standard content/ 2>/dev/null)" ]; then
+ has_content_changes=true
+ fi
+ # Check for modified tracked files in content/
+ if ! git diff --quiet content/ 2>/dev/null; then
+ has_content_changes=true
+ fi
+ # Check for staged changes in content/
+ if ! git diff --cached --quiet content/ 2>/dev/null; then
+ has_content_changes=true
+ fi
+ fi
+
+ # Step 2: Commit without content/ if there are changes
+ if [ "$has_changes_without_content" = true ]; then
+ echo "Step 2: Committing changes (without content/)..."
+ git commit -m "Update (without content/)" || exit 1
+
+ # Step 3: Push to origin (without content/)
+ echo "Step 3: Pushing to origin (without content/)..."
+ # Temporarily disable pre-push hook since we already excluded content/
+ hook_disabled=false
+ if [ -f .git/hooks/pre-push ]; then
+ mv .git/hooks/pre-push .git/hooks/pre-push.disabled
+ hook_disabled=true
+ fi
+ # Try normal push first
+ if git push origin master 2>/dev/null; then
+ # Push succeeded
+ :
+ else
+ # Push failed, try force push (origin may have diverged)
+ echo "Warning: Origin has diverged, using force push..."
+ git push origin master --force || {
+ # Restore hook if push failed
+ if [ "$hook_disabled" = true ] && [ -f .git/hooks/pre-push.disabled ]; then
+ mv .git/hooks/pre-push.disabled .git/hooks/pre-push
+ fi
+ exit 1
+ }
+ fi
+ # Restore hook after successful push
+ if [ "$hook_disabled" = true ] && [ -f .git/hooks/pre-push.disabled ]; then
+ mv .git/hooks/pre-push.disabled .git/hooks/pre-push
+ fi
+ echo "✓ Pushed to origin (without content/)"
+ else
+ echo "No changes to commit (excluding content/)"
+ fi
+
+ # Step 4: Add and commit content/ if there are changes
+ if [ "$has_content_changes" = true ]; then
+ echo "Step 4: Adding content/..."
+ git add content/
+
+ echo "Step 5: Committing content/..."
+ git commit -m "Update content/" || exit 1
+
+ # Step 6: Push to home (with content/)"
+ echo "Step 6: Pushing to home (with content/)..."
+ git push home master || exit 1
+ echo "✓ Pushed to home (with content/)"
+ else
+ echo "No content/ changes to commit"
+ fi
+
+ echo "Auto workflow completed!"
+ exit 0
+fi
+
+# If arguments provided, show usage
+echo "Usage: ppts"
+echo " Run without arguments to execute auto workflow"
+exit 1