mirror of
https://github.com/notwa/rc
synced 2025-03-15 22:42:50 -07:00
add stfu command and its prerequisites
This commit is contained in:
parent
fb5356deb2
commit
148a9fa5b6
1 changed files with 26 additions and 0 deletions
26
home/-shrc
26
home/-shrc
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue