From: b3nj4m1n Date: Sat, 5 Nov 2022 03:36:38 +0000 (+0100) Subject: Exit status = amount of fixable files X-Git-Tag: v0.2.0.2~129 X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/xdg-ninja.git/commitdiff_plain/fbd143278844fdf82060ba0454e2a7d946a702cc?ds=sidebyside Exit status = amount of fixable files Closes #94 --- 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