dotfiles

$HOME is where the <3 is
git clone git://git.alexkarle.com/dotfiles.git
Log | Files | Refs | README | LICENSE

commit 30f89f49cf0a68454f95b5baa4b7db5f23c51c9d (patch)
parent 8b1dd067d6dd60f448ddce7977cc99c3aebd636b
Author: Alex Karle <alex@alexkarle.com>
Date:   Sun, 30 Jan 2022 23:10:21 -0500

bin: Add `ep` command to Edit on Path

This is one of those things I use quite frequently to
quickly edit my own personal scripts!

It obviously fails for binaries, but it's nice to see
the source of packaged scripts too!

Diffstat:
Abin/ep | 14++++++++++++++
1 file changed, 14 insertions(+), 0 deletions(-)

diff --git a/bin/ep b/bin/ep @@ -0,0 +1,14 @@ +#!/bin/sh +die() { + echo "$*" 1>&2 + exit 1 +} + +[ -z "$1" ] && die "usage: $0 COMMAND" + +comm="$(command -v "$1")" +if [ -n "$comm" ]; then + exec "$EDITOR" "$comm" +else + die "File '$1' not on \$PATH" +fi