diff --git a/.local/bin/scripts/help b/.local/bin/scripts/help index 4260cd0..33386fe 100755 --- a/.local/bin/scripts/help +++ b/.local/bin/scripts/help @@ -19,10 +19,10 @@ case $1 in (pandoc) man pandoc; highlight "Extensions" && pandoc --list-extensions | paste -s -d' ';; (swaymsg) test $# -gt 1 && man sway "${@:2}" || man swaymsg;; (swaymsg-*) man sway "${1#swaymsg-}";; - (*) man "$@" || - { info "$1" -w | grep -v "manpages" && pinfo "$@"; } || + (*) { info "$1" -w | grep -v "manpages" && pinfo "$@"; } || + man "$@" || if which "$1" >/dev/null - then "$@" --help || { test $? == 1 && "$@" -help; } || { test $? == 1 && "$@" -h; } 2>&1 | $paginate + then { "$@" --help || { test $? == 1 && "$@" -help; } || { test $? == 1 && "$@" -h; }; } 2>&1 | $paginate fi;; esac docs="/usr/share/doc/$1" diff --git a/.local/bin/scripts/jrnl-tag b/.local/bin/scripts/jrnl-tag new file mode 100755 index 0000000..dd3d84a --- /dev/null +++ b/.local/bin/scripts/jrnl-tag @@ -0,0 +1,2 @@ +#!/bin/sh -e +rpl "\(^\|[^@]\)\b$1\b" "\1@$1" $JOURNAL/*.txt diff --git a/.local/bin/scripts/mp b/.local/bin/scripts/mp index f771656..70cdfab 100755 --- a/.local/bin/scripts/mp +++ b/.local/bin/scripts/mp @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/sh -e # [M]edia [P]lay # Play given files on mpd, playing external files through symlinking and recursively resolving playlists # depends: xargs realpath mpc diff --git a/.local/bin/scripts/rpl b/.local/bin/scripts/rpl index e63c45b..c9be95c 100755 --- a/.local/bin/scripts/rpl +++ b/.local/bin/scripts/rpl @@ -1,9 +1,8 @@ -#!/bin/sh +#!/bin/sh -e # Use grep and sed to replace $1 with $2 recursively and print what is done grep --null --recursive --files-with-matches \ - --binary-files=without-match "--exclude-dir={$DIRS_IGNORE}" "$1" | - xargs -0 sed -i "\|${1}|{ + --binary-files=without-match "--exclude-dir={$DIRS_IGNORE}" "$1" "${@:3}" | + xargs -0 sed -i "\%${1}%{ s||${2}|g w /dev/stdout }" -