commit a4ce68b2e25e2942a0aea0afe737baa71999dac3 Author: deurzen <max@deurzen.net> Date: Wed, 25 May 2022 05:24:22 +0200 initial commit Diffstat:
A | ef | | | 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