diff options
author | June McEnroe <june@causal.agency> | 2019-08-29 01:20:23 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2019-08-29 01:20:23 -0400 |
commit | bd7f109ded822b4e33697c530e9917064039b80a (patch) | |
tree | bd805bed750c3fde78ee19e93867a2b1b40be1e4 /bin | |
parent | Add samba_mdns rc script (diff) | |
download | src-bd7f109ded822b4e33697c530e9917064039b80a.tar.gz src-bd7f109ded822b4e33697c530e9917064039b80a.zip |
Add edit
Diffstat (limited to '')
-rw-r--r-- | bin/.gitignore | 1 | ||||
-rw-r--r-- | bin/Makefile | 3 | ||||
-rw-r--r-- | bin/README | 3 | ||||
-rw-r--r-- | bin/bin.7 | 5 | ||||
-rw-r--r-- | bin/edit.sh | 9 | ||||
-rw-r--r-- | bin/man1/edit.1 | 34 |
6 files changed, 52 insertions, 3 deletions
diff --git a/bin/.gitignore b/bin/.gitignore index 3bf8cbc0..b31a9d08 100644 --- a/bin/.gitignore +++ b/bin/.gitignore @@ -6,6 +6,7 @@ bit bri config.mk dtch +edit ever fbatt fbclock diff --git a/bin/Makefile b/bin/Makefile index 6f7f89dc..3eb71c62 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -15,6 +15,7 @@ BINS_ANY += aes BINS_ANY += beef BINS_ANY += bit BINS_ANY += dtch +BINS_ANY += edit BINS_ANY += glitch BINS_ANY += hi BINS_ANY += hnel @@ -59,7 +60,7 @@ linux: meta ${BINS_LINUX} tls: meta ${BINS_TLS} -meta: tags .gitignore +meta: tags .gitignore README # Binaries diff --git a/bin/README b/bin/README index ddca3e0b..240dd757 100644 --- a/bin/README +++ b/bin/README @@ -12,6 +12,7 @@ DESCRIPTION bit(1) calculator bri(1) backlight brightness control dtch(1) detached sessions + edit(1) interactive script ever(1) watch files fbatt(1) framebuffer battery indicator fbclock(1) framebuffer clock @@ -37,4 +38,4 @@ DESCRIPTION png(3) basic PNG output -Causal Agency August 28, 2019 Causal Agency +Causal Agency August 29, 2019 Causal Agency diff --git a/bin/bin.7 b/bin/bin.7 index af3bf225..0d7a1bae 100644 --- a/bin/bin.7 +++ b/bin/bin.7 @@ -1,4 +1,4 @@ -.Dd August 28, 2019 +.Dd August 29, 2019 .Dt BIN 7 .Os "Causal Agency" . @@ -31,6 +31,9 @@ backlight brightness control .It Xr dtch 1 detached sessions . +.It Xr edit 1 +interactive script +. .It Xr ever 1 watch files . diff --git a/bin/edit.sh b/bin/edit.sh new file mode 100644 index 00000000..c276707f --- /dev/null +++ b/bin/edit.sh @@ -0,0 +1,9 @@ +#!/bin/sh +set -eu + +script=$(mktemp) +trap "rm -f '$script'" EXIT + +sed "s/.*/${1:-: &}/" >> "$script" +$EDITOR "$script" +sh -eux "$script" diff --git a/bin/man1/edit.1 b/bin/man1/edit.1 new file mode 100644 index 00000000..8c94939a --- /dev/null +++ b/bin/man1/edit.1 @@ -0,0 +1,34 @@ +.Dd August 29, 2019 +.Dt EDIT 1 +.Os +. +.Sh NAME +.Nm edit +.Nd interactive script +. +.Sh SYNOPSIS +.Nm +.Op Ar replacement +. +.Sh DESCRIPTION +.Nm +creates a temporary +.Xr sh 1 +script +from standard input +and invokes +.Ev EDITOR +before it executes. +The +.Ar replacement +argument is used in a +.Xr sed 1 +substitute expression +to generate the script. +The default +.Ar replacement +is +.Ql : & . +. +.Sh EXAMPLES +.Dl ls | edit 'mv & &' |