diff --git a/.vscode/numbered-bookmarks.json b/.vscode/numbered-bookmarks.json index ce82f5a..20eb39a 100644 --- a/.vscode/numbered-bookmarks.json +++ b/.vscode/numbered-bookmarks.json @@ -4,7 +4,7 @@ "fsPath": "$ROOTPATH$/borghelper.sh", "bookmarks": [ -1, - 231, + 243, -1, -1, -1, diff --git a/borghelper.sh b/borghelper.sh index fbbcca0..37d6bd9 100755 --- a/borghelper.sh +++ b/borghelper.sh @@ -99,6 +99,10 @@ while [ $# -gt 0 ]; do restorePath="${2%/}" shift ;; + --progress) + # show progress + commonOptions="$commonOptions --progress" + ;; -r|--restore) # restore archive/file operation='restore' @@ -114,6 +118,10 @@ while [ $# -gt 0 ]; do varsFile="$2" shift ;; + --verbose) + # display each file being processed + restoreOptions="$restoreOptions --list" + ;; *) # invalid option printf "%s\nUnknown option: %s\n" "$err" "$1" @@ -155,6 +163,10 @@ if [ "$fileName" ] && [ -z "$archiveName" ]; then consoleError 1 "Filename specified without an associated archive name." fi +# clean-up leading spaces in option strings +commonOptions=${commonOptions##[[:space:]]} +restoreOptions=${restoreOptions##[[:space:]]} + ### read borg information file @@ -234,11 +246,11 @@ if [ "$operation" = 'restore' ]; then if [ -z "$fileName" ]; then # restore entire archive cd "$restorePath" || consoleError 4 'Could not change to restore directory.' - borg --show-rc extract --list ::"${archiveName}" + borg --show-rc "$commonOptions" extract "$restoreOptions" ::"${archiveName}" elif [ "$fileName" ]; then # restore single file cd "$restorePath" || consoleError 4 'Could not change to restore directory.' - borg --show-rc extract --list ::"${archiveName}" "${fileName}" + borg --show-rc "$commonOptions" extract "$restoreOptions" ::"${archiveName}" "${fileName}" fi fi