add progress and file-list options as switches
This commit is contained in:
parent
f80a66439c
commit
39f519a67e
2
.vscode/numbered-bookmarks.json
vendored
2
.vscode/numbered-bookmarks.json
vendored
@ -4,7 +4,7 @@
|
||||
"fsPath": "$ROOTPATH$/borghelper.sh",
|
||||
"bookmarks": [
|
||||
-1,
|
||||
231,
|
||||
243,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user