From 79dfc83485bfb3a5d171513bcf581749bbe02cf7 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 3 Jul 2018 17:07:38 +1200 Subject: Add mked(1df) and mkvi(1df) --- .gitignore | 2 ++ Makefile | 2 ++ README.md | 3 +++ bin/mked.sh | 6 ++++++ bin/mkvi.sh | 6 ++++++ man/man1/mked.1df | 16 ++++++++++++++++ man/man1/mkvi.1df | 16 ++++++++++++++++ 7 files changed, 51 insertions(+) create mode 100644 bin/mked.sh create mode 100644 bin/mkvi.sh create mode 100644 man/man1/mked.1df create mode 100644 man/man1/mkvi.1df 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 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 -- cgit v1.2.3