From 3d10309665136cddee85ae5dc8601782b5ab4677 Mon Sep 17 00:00:00 2001 From: Tim Byrne Date: Tue, 3 Dec 2019 08:30:51 -0600 Subject: [PATCH] Issue warning for any invalid alternates found (#183) --- yadm | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/yadm b/yadm index 650816f..f42514c 100755 --- a/yadm +++ b/yadm @@ -51,6 +51,9 @@ OPERATING_SYSTEM="Unknown" ENCRYPT_INCLUDE_FILES="unparsed" +LEGACY_WARNING_ISSUED=0 +INVALID_ALT=() + # flag causing path translations with cygpath USE_CYGPATH=0 @@ -204,6 +207,7 @@ function score_file() { return 0 # unsupported values else + INVALID_ALT+=("$src") score=0 return fi @@ -442,6 +446,40 @@ function alt() { remove_stale_links + report_invalid_alts + +} + +function report_invalid_alts() { + [ "$YADM_COMPATIBILITY" = "1" ] && return + [ "$LEGACY_WARNING_ISSUED" = "1" ] && return + [ "${#INVALID_ALT[@]}" = "0" ] && return + local path_list + for invalid in "${INVALID_ALT[@]}"; do + path_list="$path_list * $invalid"$'\n' + done + cat < + + Invalid alternates detected: +${path_list} +*********** +EOF } function remove_stale_links() { @@ -1371,6 +1409,8 @@ ${path_list} *********** EOF +LEGACY_WARNING_ISSUED=1 + } function configure_paths() {