1.1 --- a/vcs-backup.sh Sat Apr 20 20:20:32 2019 +0200
1.2 +++ b/vcs-backup.sh Sat Apr 20 22:17:38 2019 +0200
1.3 @@ -63,6 +63,15 @@
1.4 echo "$1" | sed -E 's@^[^:]+://@@g';
1.5 }
1.6
1.7 +# Environment: all
1.8 +# $1 = optional value (if missing, reads STDIN)
1.9 +escapeRecfileValue() { if [[ $# = 0 ]]; then awk '{ if (NR > 1) { printf "+ " } print $_ }'; else echo "${@}" | ${FUNCNAME[0]}; fi }
1.10 +
1.11 +# Environment: all
1.12 +# $1 = key
1.13 +# $2 = value
1.14 +printRecfileKeyValue() { echo -n "$1: "; escapeRecfileValue "$2"; }
1.15 +
1.16 # --- Public interface functions: ------------------------------------------------------------------
1.17
1.18 # Environment: client
1.19 @@ -180,13 +189,13 @@
1.20 elif [[ "$vcsType" == "git" ]]; then lastCommit=$(git -C "$VCS_BACKUP_CURRENT_DIR/$d" log --max-count=1 --pretty="%ai");
1.21 else lastCommit=""; fi
1.22
1.23 - echo "type: $vcsType";
1.24 - echo "url: $url";
1.25 - echo "state: $state";
1.26 - echo "public: $public";
1.27 - echo "serverPath: $VCS_BACKUP_CURRENT_DIR/$d";
1.28 - echo "size: $sizeBytes";
1.29 - echo "lastCommit: $lastCommit";
1.30 + printRecfileKeyValue "type" "$vcsType";
1.31 + printRecfileKeyValue "url" "$url";
1.32 + printRecfileKeyValue "state" "$state";
1.33 + printRecfileKeyValue "public" "$public";
1.34 + printRecfileKeyValue "serverPath" "$VCS_BACKUP_CURRENT_DIR/$d";
1.35 + printRecfileKeyValue "size" "$sizeBytes";
1.36 + printRecfileKeyValue "lastCommit" "$lastCommit";
1.37 echo;
1.38 done
1.39 }