1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-06-26 09:07:12 -07:00

add stfu command and its prerequisites

This commit is contained in:
Connor Olding 2020-11-05 17:09:49 +01:00
parent fb5356deb2
commit 148a9fa5b6

View File

@ -194,6 +194,32 @@ eashare() {
printf "%s" "$_REMOTE_DOMAIN/$_REMOTE_DIR/$dest" > /dev/clipboard
}
echo2() {
local IFS=" "
printf "%s\n" "$*" >&2
}
note() {
local IFS=" "
printf "\033[1m%s\033[0m\n" "$*" >&2
}
stfu() {
local ret=0
"$@" > .stdout 2> .stderr || ret=$?
if test "$ret" -ne 0; then
printf "command failed with exit status %s:\n" "$ret" >&2
echo2 "$@"
echo2
note '$ tail -n 20 .stdout'
tail -n 20 .stdout >&2
echo2
note '$ tail -n 20 .stderr'
tail -n 20 .stderr >&2
return "$ret"
fi
}
# sources {{{1
if [ $FANCY -eq 1 ]; then