From 0f6529a0d86a65e100042466339e8629c38cb9fe Mon Sep 17 00:00:00 2001 From: Ethan P Date: Wed, 28 Oct 2020 19:40:35 -0700 Subject: [PATCH] batdiff: Make --all default behavior for no arguments --- src/batdiff.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/batdiff.sh b/src/batdiff.sh index cb59eb7..f1c7e1c 100755 --- a/src/batdiff.sh +++ b/src/batdiff.sh @@ -141,24 +141,23 @@ fi # Validation: # ----------------------------------------------------------------------------- -# Handle no files. -if [[ "${#FILES[@]}" -eq 0 ]] && ! "$OPT_ALL_CHANGES"; then - print_error "no files provided" - exit 1 -fi - # Handle too many files. if [[ "${#FILES[@]}" -gt 2 ]]; then print_error "too many files provided" exit 1 fi +# Handle deprecated --all. +if "$OPT_ALL_CHANGES"; then + print_warning "argument --all is deprecated. Use '%s' instead" "$0" +fi + # ----------------------------------------------------------------------------- # Main: # ----------------------------------------------------------------------------- main() { - if "$OPT_ALL_CHANGES"; then + if [[ "${#FILES[@]}" -eq 0 ]] || "$OPT_ALL_CHANGES"; then local file while read -r file; do if [[ -f "$file" ]]; then