diff options
author | June McEnroe <june@causal.agency> | 2021-06-21 11:07:01 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2021-06-21 11:07:01 -0400 |
commit | 1af2261bac99393909467308bb0299961c672a82 (patch) | |
tree | ed5b698da294caa6304f77116c82ee1673ec7644 /bin | |
parent | Merge dash v0.5.11.4 (diff) | |
download | src-1af2261bac99393909467308bb0299961c672a82.tar.gz src-1af2261bac99393909467308bb0299961c672a82.zip |
Use $SHELL -c to run up -c | -t commands
And clean up some other things.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/man1/up.1 | 7 | ||||
-rw-r--r-- | bin/up.sh | 19 |
2 files changed, 12 insertions, 14 deletions
diff --git a/bin/man1/up.1 b/bin/man1/up.1 index 189020de..2240b99a 100644 --- a/bin/man1/up.1 +++ b/bin/man1/up.1 @@ -1,4 +1,4 @@ -.Dd February 7, 2021 +.Dd June 21, 2021 .Dt UP 1 .Os . @@ -13,7 +13,7 @@ . .Nm .Fl c | t -.Ar command ... +.Ar command . .Nm .Fl s @@ -58,8 +58,7 @@ or .Xr scrot 1 to produce a PNG file for upload. The file is optimized by -.Xr pngo 1 -if available. +.Xr pngo 1 . .It Fl t Run a command with .Xr ptee 1 diff --git a/bin/up.sh b/bin/up.sh index f55213d4..3da132c1 100644 --- a/bin/up.sh +++ b/bin/up.sh @@ -4,7 +4,6 @@ set -eu readonly Host='temp.causal.agency' upload() { - local src ext ts rand url src=$1 ext=${src##*.} ts=$(date +'%s') @@ -16,25 +15,25 @@ upload() { temp() { temp=$(mktemp -d) - trap "rm -r '$temp'" EXIT + trap 'rm -r "$temp"' EXIT } uploadText() { temp - cat > "${temp}/input.txt" + cat >"${temp}/input.txt" upload "${temp}/input.txt" } uploadCommand() { temp - echo "$ $*" > "${temp}/exec.txt" - "$@" >> "${temp}/exec.txt" 2>&1 || true + echo "$ $1" >"${temp}/exec.txt" + $SHELL -c "$1" >>"${temp}/exec.txt" 2>&1 || true upload "${temp}/exec.txt" } uploadHilex() { temp - hilex -f html -o document,tab=4 "$@" > "${temp}/hilex.html" + hilex -f html -o document,tab=4 "$@" >"${temp}/hilex.html" upload "${temp}/hilex.html" } @@ -45,25 +44,25 @@ uploadScreen() { else scrot -s "$@" "${temp}/capture.png" fi - pngo "${temp}/capture.png" || true + pngo "${temp}/capture.png" upload "${temp}/capture.png" } uploadTerminal() { temp - cat > "${temp}/term.html" <<-EOF + cat >"${temp}/term.html" <<-EOF <!DOCTYPE html> <title>${1}</title> <style> $(scheme -s) </style> EOF - ptee "$@" | shotty -Bs >> "${temp}/term.html" + ptee $SHELL -c "$1" | shotty -Bs >>"${temp}/term.html" upload "${temp}/term.html" } while getopts 'chst' opt; do - case "$opt" in + case $opt in (c) fn=uploadCommand;; (h) fn=uploadHilex;; (s) fn=uploadScreen;; |