mirror of
https://github.com/notwa/rc
synced 2024-07-01 03:07:13 -07:00
add stfu command and its prerequisites
This commit is contained in:
parent
fb5356deb2
commit
148a9fa5b6
26
home/-shrc
26
home/-shrc
|
@ -194,6 +194,32 @@ eashare() {
|
||||||
printf "%s" "$_REMOTE_DOMAIN/$_REMOTE_DIR/$dest" > /dev/clipboard
|
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
|
# sources {{{1
|
||||||
|
|
||||||
if [ $FANCY -eq 1 ]; then
|
if [ $FANCY -eq 1 ]; then
|
||||||
|
|
Loading…
Reference in New Issue
Block a user