commit c1edd9466fba34610bb424ca681bdfdd4b96593b
parent bddcf71f0809a39d7f4fa1d057fede99ffe898c0
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Sat, 10 Feb 2024 19:27:56 +0100
Small improvement of the status sub-command
Use the -s option of the test directive to check that a file list is
empty instead of counting its number of lines. This sucks less zero and
is more efficient
Diffstat:
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/git-wad b/git-wad
@@ -383,16 +383,14 @@ status() # [--all]
fi
# List resolved WADs, if any
- n="$(wc -l < "${resolved}")"
- if [ "${n}" -gt 0 ]; then
+ if [ -s "${resolved}" ]; then
printf "Resolved WADs:\n"
xargs -I{} printf "\t\e[0;32m%s\e[0m\n" {} < "${resolved}"
printf "\n"
fi
# List un-restored WADs, if any
- n="$(wc -l < "${unrestored}")"
- if [ "${n}" -gt 0 ]; then
+ if [ -s "${unrestored}" ]; then
printf "Unrestored WADs:\n"
printf " (use \"git wad checkout\" to restore WADs)\n"
xargs -I {} printf "\t\e[0;33m%s\e[0m\n" {} < "${unrestored}"
@@ -400,8 +398,7 @@ status() # [--all]
fi
# List orphaned WADs, if any
- n="$(wc -l < "${orphaned}")"
- if [ "${n}" -gt 0 ]; then
+ if [ -s "${orphaned}" ]; then
printf "Orphaned WADs:\n"
printf " (use \"git wad pull\" to download and restore WADs)\n"
xargs -I {} printf "\t\e[0;31m%s\e[0m\n" {} < "${orphaned}"