summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-07-15 23:13:19 -0400
committerJune McEnroe <june@causal.agency>2019-07-15 23:13:19 -0400
commit55c111d59ce0ee9ddc8297af709a2ff122704895 (patch)
treeb7f818cd4335a2fa09f8f64b42d6f13b9d386ec0
parentImplement scrolling region (diff)
downloadsrc-55c111d59ce0ee9ddc8297af709a2ff122704895.tar.gz
src-55c111d59ce0ee9ddc8297af709a2ff122704895.zip
Add up -t
-rw-r--r--bin/man1/up.117
-rw-r--r--bin/up.sh16
2 files changed, 30 insertions, 3 deletions
diff --git a/bin/man1/up.1 b/bin/man1/up.1
index 07f25e33..58b5359f 100644
--- a/bin/man1/up.1
+++ b/bin/man1/up.1
@@ -1,4 +1,4 @@
-.Dd July 9, 2019
+.Dd July 15, 2019
 .Dt UP 1
 .Os
 .
@@ -8,9 +8,16 @@
 .
 .Sh SYNOPSIS
 .Nm
-.Op Fl chs
+.Op Fl h
 .Op Ar file
 .
+.Nm
+.Fl c | t
+.Ar command ...
+.
+.Nm
+.Fl s
+.
 .Sh DESCRIPTION
 .Nm
 uploads a file
@@ -51,6 +58,12 @@ to produce a PNG file for upload.
 The file is optimized by
 .Xr pngo 1
 if available.
+.It Fl t
+Run a command with
+.Xr ptee 1
+and
+.Xr shotty 1
+to produce an HTML file for upload.
 .El
 .
 .Pp
diff --git a/bin/up.sh b/bin/up.sh
index ef3ff6c7..a439c8f7 100644
--- a/bin/up.sh
+++ b/bin/up.sh
@@ -45,13 +45,27 @@ uploadScreen() {
 	upload "${temp}/capture.png"
 }
 
-args=$(setopt 'chs' "$@")
+uploadTerminal() {
+	temp
+	cat > "${temp}/term.html" <<-EOF
+	<!DOCTYPE html>
+	<title>${1}</title>
+	<style>
+	$(scheme -s)
+	</style>
+	EOF
+	ptee "$@" | shotty -Bcs >> "${temp}/term.html"
+	upload "${temp}/term.html"
+}
+
+args=$(setopt 'chst' "$@")
 eval set -- "$args"
 for opt; do
 	case "$opt" in
 		(-c) shift; fn=uploadCommand;;
 		(-h) shift; fn=uploadHi;;
 		(-s) shift; fn=uploadScreen;;
+		(-t) shift; fn=uploadTerminal;;
 		(--) shift; break;;
 	esac
 done