]> gitweb.hhaalo.de Git - simple-backup.git/commitdiff
add no color and path backup method not implement
authorBastian Dehn <hhaalo@arcor.de>
Wed, 5 Aug 2026 15:27:47 +0000 (17:27 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Wed, 5 Aug 2026 15:27:47 +0000 (17:27 +0200)
src/backup
tests/backup_tests.bats

index 6ede52da6a6a2120bc9922cde7d22b95b2f2c4a1..7ab21bcf62c38004565310a77e62cae159e293f8 100755 (executable)
@@ -128,6 +128,16 @@ print_line()
        printf "\n"
 }
 
+path_backup()
+{
+       local config="$1"
+       local machine="$2"
+       local path="$3"
+       local full_backup_path="$4"
+
+       # TODO: config read - rsync implementation
+}
+
 machine_backup_pathes()
 {
        local YELLOW="\e[0;33m"
@@ -139,12 +149,18 @@ machine_backup_pathes()
        local pathes=()
        mapfile -t pathes < <(echo "$config" \
                | jq --raw-output ".machines.$machine.pathes[]")
+       [ -n "$NOCOLOR" ] && YELLOW= && LIGHTPURPLE= && RESET=
 
        local path=
        for path in "${pathes[@]}"; do
                print_line
                printf "ℹ️ INFO: machine ${LIGHTPURPLE}%s${RESET}; " "$machine"
                printf "path ${YELLOW}%s${RESET}\n\n" "$path"
+               path_backup "$config" \
+                       "$machine" \
+                       "$path" \
+                       "$full_backup_path" \
+                       || return $?
                print_line
        done
 }
index 0b614f3cde78763852e5f8589ce486849fa0cd54..eb1ec4f04456b766ad0857ff0f58924bf4b4c4d1 100755 (executable)
@@ -4,6 +4,7 @@ setup() {
        bats_load_library 'bats-support'
        bats_load_library 'bats-assert'
        export TESTMODE="ON"
+       export NOCOLOR="ON"
        export CONFIG_FILE="src/config-example.yaml"
        source src/backup
        date() {
@@ -13,6 +14,7 @@ setup() {
 
 teardown() {
        unset TESTMODE
+       unset NOCOLOR
        unset CONFIG_FILE
        rm --recursive --force "build/2000-01-01_01_backup"
 }