From 0d45f2f61a798b59daeb1f12799e799c5176c434 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Wed, 21 Jun 2023 13:34:45 +0200 Subject: [PATCH] zsh:suffix(): Use `bfs` if installed --- .config/zsh/zshrc.d/40-functions.zsh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.config/zsh/zshrc.d/40-functions.zsh b/.config/zsh/zshrc.d/40-functions.zsh index 9083ccd..8c16d9e 100644 --- a/.config/zsh/zshrc.d/40-functions.zsh +++ b/.config/zsh/zshrc.d/40-functions.zsh @@ -521,8 +521,13 @@ shellcheck() { # `sfx` is given to `find` in the form `-name "*$sfx"`. # `path` is given as starting point to `find`, defaulting to `.`. suffix() { - if (( ! $+commands[find] )); then - printf >&2 "find not installed\n" + local cmd + if (( $+commands[bfs] )); then + cmd=bfs + elif (( $+commands[find] )); then + cmd=find + else + printf >&2 "Neither bfs nor find installed\n" return 1 fi @@ -538,7 +543,7 @@ suffix() { # Join with " -o -name " and then split again using shell parsing names=( "${(@zj: -o -name :)names}" ) # Pass starting points and the name arguments - find "${@:$((i+1))}" -name "${(@)names}" + "$cmd" "${@:$((i+1))}" -name "${(@)names}" } # Find duplicate files