From e218b6bf4ca2aa608d3a790a167ccabe3a5db114 Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Wed, 28 Jun 2023 11:08:01 +0200 Subject: [PATCH] Add optional root directory for find-edit command --- bin/find-edit | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/find-edit b/bin/find-edit index 002f7b9..d7b8bee 100755 --- a/bin/find-edit +++ b/bin/find-edit @@ -2,21 +2,22 @@ ignore='-not -path "*/.*/*"' +root="." while test $# != 0 do case "$1" in - -h) unset ignore ;; + -h) unset ignore; shift ;; + -r) root="$2"; shift 2;; --) shift; break ;; *) break ;; esac - shift done if [ -f "$1" ] then $EDITOR $1 else - file=$(sh -c "find . $ignore -type f" | fzf -m -1 -q "$*") + file=$(sh -c "find $root $ignore -type f" | fzf -m -1 -q "$*") if [ "$?" -eq 0 ] then echo "$file" | xargs -d '\n' $EDITOR