edfind

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

ef (296B)


      1 #!/usr/bin/env bash
      2 set -Eeo pipefail
      3 
      4 if [ $# -eq 0 ]; then
      5     1>&2 echo "no arguments provided"
      6     exit 1
      7 fi
      8 
      9 REGEX="$1"
     10 shift
     11 
     12 MATCHES="`fd --type f --follow "${REGEX}" $@`"
     13 
     14 if test -z "${MATCHES}"; then
     15     1>&2 echo "no results match regex"
     16     exit 2
     17 else
     18     eval $EDITOR ${MATCHES}
     19 fi