#!/bin/bash

resticDumpFile()
{
    local idx="$1"
    local snapshot_id="$2"
    local file_path="$3"
    local target_file="$4"

    resticEnvExport "$idx" || return 1

    if [[ -n "$target_file" ]]; then
        runBackupOp restic dump "$snapshot_id" "$file_path" | runBackupOp tee "$target_file" >/dev/null
    else
        runBackupOp restic dump "$snapshot_id" "$file_path"
    fi
    local rc=$?
    resticEnvUnset
    return $rc
}
