From cb57eff45e97a1d51d68bd313f0a44335274a3db Mon Sep 17 00:00:00 2001 From: Eric Torres Date: Fri, 30 Sep 2022 23:51:27 -0700 Subject: [PATCH] Run shfmt --- bash/search.sh | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/bash/search.sh b/bash/search.sh index 89c45d7..90a5dbd 100644 --- a/bash/search.sh +++ b/bash/search.sh @@ -6,13 +6,13 @@ DEFAULT_FD_OPTS=('--hidden' '--type' 'symlink' '--threads' "$(nproc)") # $1: directory # $2-n: extra arguments find_files() { - if [[ -d "$1" ]]; then - local directory="$1" - shift - fd "${DEFAULT_FD_OPTS[@]}" --type f "$@" -- . "$directory" - else - fd "${DEFAULT_FD_OPTS[@]}" --type f "$@" - fi + if [[ -d "$1" ]]; then + local directory="$1" + shift + fd "${DEFAULT_FD_OPTS[@]}" --type f "$@" -- . "$directory" + else + fd "${DEFAULT_FD_OPTS[@]}" --type f "$@" + fi } # Search and return a string with filenames delimited by \n @@ -20,13 +20,13 @@ find_files() { # $1: directory # $2-n: extra arguments find_directories() { - if [[ -d "$1" ]]; then - local directory="$1" - shift - fd "${DEFAULT_FD_OPTS[@]}" --type d "$@" -- . "$directory" - else - fd "${DEFAULT_FD_OPTS[@]}" --type d "$@" - fi + if [[ -d "$1" ]]; then + local directory="$1" + shift + fd "${DEFAULT_FD_OPTS[@]}" --type d "$@" -- . "$directory" + else + fd "${DEFAULT_FD_OPTS[@]}" --type d "$@" + fi } # Search all files and directories, determine what type of files to search @@ -37,11 +37,11 @@ find_directories() { find_specific() { local type_opt="$1" shift - if [[ -d "$1" ]]; then - local directory="$1" - shift - fd "${DEFAULT_FD_OPTS[@]}" --type "$type_opt" "$@" -- . "$directory" - else - fd "${DEFAULT_FD_OPTS[@]}" --type "$type_opt" "$@" - fi + if [[ -d "$1" ]]; then + local directory="$1" + shift + fd "${DEFAULT_FD_OPTS[@]}" --type "$type_opt" "$@" -- . "$directory" + else + fd "${DEFAULT_FD_OPTS[@]}" --type "$type_opt" "$@" + fi }