summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-07-09 23:35:52 -0400
committerJune McEnroe <june@causal.agency>2019-07-09 23:35:52 -0400
commit539da9d430ffb5afbd1120eaa9987ad7fa8481ce (patch)
tree56e59a61d4d5b5084e5e766aed9ae59a1c27ba06
parentAdd options for default colors to shotty (diff)
downloadsrc-539da9d430ffb5afbd1120eaa9987ad7fa8481ce.tar.gz
src-539da9d430ffb5afbd1120eaa9987ad7fa8481ce.zip
Add up -c
-rw-r--r--bin/man1/up.17
-rw-r--r--bin/up.sh10
2 files changed, 14 insertions, 3 deletions
diff --git a/bin/man1/up.1 b/bin/man1/up.1
index f479b7ad..07f25e33 100644
--- a/bin/man1/up.1
+++ b/bin/man1/up.1
@@ -1,4 +1,4 @@
-.Dd February 2, 2019
+.Dd July 9, 2019
 .Dt UP 1
 .Os
 .
@@ -8,7 +8,7 @@
 .
 .Sh SYNOPSIS
 .Nm
-.Op Fl hs
+.Op Fl chs
 .Op Ar file
 .
 .Sh DESCRIPTION
@@ -37,6 +37,9 @@ if available.
 .Pp
 The arguments are as follows:
 .Bl -tag -width Ds
+.It Fl c
+Run a command
+to produce a text file for upload.
 .It Fl h
 Use
 .Xr hi 1
diff --git a/bin/up.sh b/bin/up.sh
index 07a0b76b..ef3ff6c7 100644
--- a/bin/up.sh
+++ b/bin/up.sh
@@ -25,6 +25,13 @@ uploadText() {
 	upload "${temp}/input.txt"
 }
 
+uploadCommand() {
+	temp
+	echo "$ $*" > "${temp}/exec.txt"
+	"$@" >> "${temp}/exec.txt"
+	upload "${temp}/exec.txt"
+}
+
 uploadHi() {
 	temp
 	hi -f html -o document,anchor,tab=4 "$@" > "${temp}/hi.html"
@@ -38,10 +45,11 @@ uploadScreen() {
 	upload "${temp}/capture.png"
 }
 
-args=$(setopt 'hs' "$@")
+args=$(setopt 'chs' "$@")
 eval set -- "$args"
 for opt; do
 	case "$opt" in
+		(-c) shift; fn=uploadCommand;;
 		(-h) shift; fn=uploadHi;;
 		(-s) shift; fn=uploadScreen;;
 		(--) shift; break;;