From 55603814e41edb3c0705b18ba54c8b66313264d8 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Fri, 2 Jul 2021 18:33:30 +0200 Subject: [PATCH] bin: add help & tracefile, auto-resolve intention conflicts --- .local/bin/scripts/b | 5 +++-- .local/bin/scripts/help | 8 ++++++++ .local/bin/scripts/st-diff | 4 +++- .local/bin/scripts/tracefile | 2 ++ 4 files changed, 16 insertions(+), 3 deletions(-) create mode 100755 .local/bin/scripts/help create mode 100755 .local/bin/scripts/tracefile diff --git a/.local/bin/scripts/b b/.local/bin/scripts/b index 51b4b43..a2340c9 100755 --- a/.local/bin/scripts/b +++ b/.local/bin/scripts/b @@ -11,6 +11,7 @@ test -e "$last" || exit 1 case "$(file --dereference --mime "$last")" in *inode/directory*) ls -l --color=always --human-readable --group-directories-first --file-type --dereference-command-line --almost-all "$@";; *binary) ;; - *) $(test -f "$last" -a ! -r "$last" && echo "sudo") bat --style header "$@" - stat --format '%A size %sB, birth: %.10w mod %.10y' "$last";; + *) $(test -f "$last" -a ! -r "$last" && echo "sudo") bat --style header --pager "less --LONG-PROMPT --quit-if-one-screen" "$@" + tput setaf 3 && stat --format '%A size %sB, birth: %.10w mod %.10y' "$last" + ;; esac diff --git a/.local/bin/scripts/help b/.local/bin/scripts/help new file mode 100755 index 0000000..0e46054 --- /dev/null +++ b/.local/bin/scripts/help @@ -0,0 +1,8 @@ +#!/bin/sh +case $1 in + (vlc) unbuffer vlc --full-help "${@:2}" | ${PAGER:-less} --quit-if-one-screen;; + (zmv) # https://unix.stackexchange.com/questions/19290/zmv-for-zsh-dry-runs-and-man-pages + # need to install zsh-doc for info + info --index-search=zmv zsh || LESS="$LESS +/^ *zmv *\\[" man zshcontrib;; + (*) man "$@" || "$@" --help | ${PAGER:-less} --quit-if-one-screen;; +esac diff --git a/.local/bin/scripts/st-diff b/.local/bin/scripts/st-diff index e14e0aa..2c8ad10 100755 --- a/.local/bin/scripts/st-diff +++ b/.local/bin/scripts/st-diff @@ -20,5 +20,7 @@ if test "$#" -gt 0 (m) touch /tmp/empty && git merge-file "$orig" /tmp/empty "$1" && nvim "$orig" && rm "$1";; esac fi - else find -name '*sync-conflict*' -exec st-diff $quick '{}' \; + else + find "$DATA/2-standards/notes/journal" -name "intentions.sync-conflict*" -exec jrnl intentions --import --file {} \; -delete + find -name '*sync-conflict*' -exec st-diff $quick '{}' \; fi diff --git a/.local/bin/scripts/tracefile b/.local/bin/scripts/tracefile new file mode 100755 index 0000000..6e5799d --- /dev/null +++ b/.local/bin/scripts/tracefile @@ -0,0 +1,2 @@ +#!/bin/sh +strace --follow-forks -e trace=file "$@" 2>&1 >/dev/null | grep openat | cut -d'"' -f2 | grep -v ".so" | grep -v "/dev/" | less