From 72225e7bbae228a394bff475259457bb12cc2b21 Mon Sep 17 00:00:00 2001 From: Ari Archer Date: Fri, 20 May 2022 20:36:46 +0300 Subject: [PATCH] Reduce ammount of indent calls Signed-off-by: Ari Archer --- baz | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/baz b/baz index b864766..bc714b4 100755 --- a/baz +++ b/baz @@ -2,7 +2,7 @@ [ "$BAZ_DEBUG" ] && set -x -export BAZ_VERSION='1.3.3' +export BAZ_VERSION='1.3.4' export BAZ_DIR="$HOME/.local/share/baz" export BAZ_CONFDIR="$HOME/.config/baz" export BAZ_CONF="$BAZ_CONFDIR/config.env" @@ -470,9 +470,11 @@ baz_install() { [ ! "$2" ] && error 'no atom specified' log 'Will install:' - for dir in "${@:2}"; do - log "$dir" | indent - done + { + for dir in "${@:2}"; do + log "$dir" + done + } | indent eecho if [ "$BAZP_NO_ASKINST" != 'true' ]; then @@ -492,14 +494,16 @@ baz_install() { baz_uinstall() { log 'Will uninstall:' - for plugin in "$@"; do - if [ ! -d "$BAZ_PLUGDIR/$plugin" ]; then - error "Plugin '$plugin' not installed" | indent - return 1 - fi + { + for plugin in "$@"; do + if [ ! -d "$BAZ_PLUGDIR/$plugin" ]; then + error "Plugin '$plugin' not installed" + return 1 + fi - log "$plugin" | indent - done + log "$plugin" + done + } | indent eecho yn 'Are you sure?' && @@ -516,9 +520,11 @@ baz_list() { log 'Installed plugins:' - while read -r dir; do - log "$(get_base "$dir")" | indent >&2 - done <<<"$(find "$BAZ_PLUGDIR" -maxdepth 1 -not -path "$BAZ_PLUGDIR" -type d)" + { + while read -r dir; do + log "$(get_base "$dir")" + done <<<"$(find "$BAZ_PLUGDIR" -maxdepth 1 -not -path "$BAZ_PLUGDIR" -type d)" + } | indent >&2 } baz_update() {