bin: add jrnl-tag & errexit

This commit is contained in:
xeruf 2022-04-12 19:31:46 +02:00
parent 2230d3fada
commit f2bd42f3f6
4 changed files with 9 additions and 8 deletions

View File

@ -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"

2
.local/bin/scripts/jrnl-tag Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh -e
rpl "\(^\|[^@]\)\b$1\b" "\1@$1" $JOURNAL/*.txt

View File

@ -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

View File

@ -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
}"