edfind

Populate $EDITOR with files that match file search
git clone git://git.deurzen.net/edfind
Log | Files | Refs

commit a4ce68b2e25e2942a0aea0afe737baa71999dac3
Author: deurzen <max@deurzen.net>
Date:   Wed, 25 May 2022 05:24:22 +0200

initial commit

Diffstat:
Aef | 19+++++++++++++++++++
1 file changed, 19 insertions(+), 0 deletions(-)

diff --git a/ef b/ef @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +set -Eeo pipefail + +if [ $# -eq 0 ]; then + 1>&2 echo "no arguments provided" + exit 1 +fi + +REGEX="$1" +shift + +MATCHES="`fd --type f --follow "${REGEX}" $@`" + +if test -z "${MATCHES}"; then + 1>&2 echo "no results match regex" + exit 2 +else + eval $EDITOR ${MATCHES} +fi