aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-07-03 17:07:38 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-07-03 17:07:38 +1200
commit79dfc83485bfb3a5d171513bcf581749bbe02cf7 (patch)
tree72532a1ba7248578ca7973fd205a3970ecacfcd6
parent49ed1f990e13faa1ae78a0a1864fe475f3e87206 (diff)
downloaddotfiles-79dfc83485bfb3a5d171513bcf581749bbe02cf7.tar.gz
Add mked(1df) and mkvi(1df)
-rw-r--r--.gitignore2
-rw-r--r--Makefile2
-rw-r--r--README.md3
-rw-r--r--bin/mked.sh6
-rw-r--r--bin/mkvi.sh6
-rw-r--r--man/man1/mked.1df16
-rw-r--r--man/man1/mkvi.1df16
7 files changed, 51 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index f809b6f8..98ac8372 100644
--- a/.gitignore
+++ b/.gitignore
@@ -66,8 +66,10 @@ bin/mim.sh
bin/mim.m4
bin/min
bin/mkcp
+bin/mked
bin/mkmv
bin/mktd
+bin/mkvi
bin/mode
bin/motd
bin/murl
diff --git a/Makefile b/Makefile
index 03f2740b..c64d5ce3 100644
--- a/Makefile
+++ b/Makefile
@@ -145,8 +145,10 @@ BINS = bin/ap \
bin/mim \
bin/min \
bin/mkcp \
+ bin/mked \
bin/mkmv \
bin/mktd \
+ bin/mkvi \
bin/mode \
bin/motd \
bin/murl \
diff --git a/README.md b/README.md
index 85342e14..9792a162 100644
--- a/README.md
+++ b/README.md
@@ -489,6 +489,9 @@ Installed by the `install-bin` target:
pipeline.
* `ped(1df)` runs `pst(1df)` with `$EDITOR` or `ed(1)`.
* `pvi(1df)` runs `pvi(1df)` with `$VISUAL` or `vi(1)`.
+* Two editor wrapper tools:
+ * `mked(1df)` creates paths to all its arguments before invoking `$EDITOR`.
+ * `mkvi(1df)` creates paths to all its arguments before invoking `$VISUAL`.
* `ap(1df)` reads arguments for a given command from the standard input,
prompting if appropriate.
* `apf(1df)` inserts arguments to a command with ones read from a file,
diff --git a/bin/mked.sh b/bin/mked.sh
new file mode 100644
index 00000000..4e280205
--- /dev/null
+++ b/bin/mked.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# Create paths to all files before invoking editor
+for file ; do
+ mkdir -p -- "${file%/*}" || exit
+done
+exec "$EDITOR" "$@"
diff --git a/bin/mkvi.sh b/bin/mkvi.sh
new file mode 100644
index 00000000..244b89f8
--- /dev/null
+++ b/bin/mkvi.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# Create paths to all files before invoking editor
+for file ; do
+ mkdir -p -- "${file%/*}" || exit
+done
+exec "$VISUAL" "$@"
diff --git a/man/man1/mked.1df b/man/man1/mked.1df
new file mode 100644
index 00000000..202ba386
--- /dev/null
+++ b/man/man1/mked.1df
@@ -0,0 +1,16 @@
+.TH MKVI 1df "July 2018" "Manual page for mked"
+.SH NAME
+.B mked
+\- create paths to all argument files before invoking $EDITOR
+.SH SYNOPSIS
+.B mked
+file0 dir1/file1 dir2/subdir/file2
+.SH DESCRIPTION
+.B mked
+iterates through its arguments and creates the full paths to each of them
+before running $EDITOR with the same arguments. If the directory creation
+fails, the script stops before invoking the editor.
+.SH SEE ALSO
+mked(1)
+.SH AUTHOR
+Tom Ryder <tom@sanctum.geek.nz>
diff --git a/man/man1/mkvi.1df b/man/man1/mkvi.1df
new file mode 100644
index 00000000..f0f215d4
--- /dev/null
+++ b/man/man1/mkvi.1df
@@ -0,0 +1,16 @@
+.TH MKVI 1df "July 2018" "Manual page for mkvi"
+.SH NAME
+.B mkvi
+\- create paths to all argument files before invoking $VISUAL
+.SH SYNOPSIS
+.B mkvi
+file0 dir1/file1 dir2/subdir/file2
+.SH DESCRIPTION
+.B mkvi
+iterates through its arguments and creates the full paths to each of them
+before running $VISUAL with the same arguments. If the directory creation
+fails, the script stops before invoking the editor.
+.SH SEE ALSO
+mked(1)
+.SH AUTHOR
+Tom Ryder <tom@sanctum.geek.nz>