From fbd143278844fdf82060ba0454e2a7d946a702cc Mon Sep 17 00:00:00 2001 From: b3nj4m1n Date: Sat, 5 Nov 2022 04:36:38 +0100 Subject: [PATCH] Exit status = amount of fixable files Closes #94 --- xdg-ninja.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xdg-ninja.sh b/xdg-ninja.sh index ed0e8dd..8332207 100755 --- a/xdg-ninja.sh +++ b/xdg-ninja.sh @@ -136,6 +136,9 @@ decode_string() { /' # Replace \n with literal newline and \" with ", normalize number of trailing newlines to 2 } +# Counter to keep track of how many files can be moved +FIXABLE=0 + # Function to handle the formatting of output log() { MODE="$1" @@ -147,6 +150,7 @@ log() { ERR) printf '[%b%s%b]: %b%s%b\n' "${FX_BOLD}${FG_RED}" "$NAME" "${FX_RESET}" "${FX_BOLD}${FX_ITALIC}" "$FILENAME" "${FX_RESET}" + FIXABLE=$((FIXABLE+1)) ;; WARN) @@ -223,3 +227,4 @@ check_programs() { check_programs +exit $FIXABLE -- 2.47.3