add info operations

This commit is contained in:
Asif Bacchus 2020-03-26 04:43:27 -06:00
parent 39f519a67e
commit 7bd6f369e7
2 changed files with 17 additions and 3 deletions

View File

@ -4,15 +4,15 @@
"fsPath": "$ROOTPATH$/borghelper.sh", "fsPath": "$ROOTPATH$/borghelper.sh",
"bookmarks": [ "bookmarks": [
-1, -1,
243, 257,
151,
-1, -1,
-1, -1,
-1, -1,
-1, -1,
-1, -1,
-1, -1,
-1, 84
61
] ]
} }
] ]

View File

@ -82,6 +82,10 @@ while [ $# -gt 0 ]; do
printf "\nStill working on the help text :-)\n\n" printf "\nStill working on the help text :-)\n\n"
exit 0 exit 0
;; ;;
-i|--info)
# show archive information
operation='info'
;;
-l|--list) -l|--list)
# list contents of specific backup # list contents of specific backup
operation='viewarchive' operation='viewarchive'
@ -145,6 +149,11 @@ if [ -z "$varsFile" ]; then
consoleError 1 'You must provide a valid .borgvars file with information about your borg repo.' consoleError 1 'You must provide a valid .borgvars file with information about your borg repo.'
fi fi
# info without archive
if [ "$operation" = 'info' ] && [ -z "$archiveName" ]; then
consoleError 1 "Info operation requested but no archive name provided. Please use '--list-all' for a list of all available archives."
fi
# list without archive # list without archive
if [ "$operation" = 'viewarchive' ] && [ -z "$archiveName" ]; then if [ "$operation" = 'viewarchive' ] && [ -z "$archiveName" ]; then
consoleError 1 "List operation requested but no archive name provided. Please use '--list-all' for a list of all available archives." consoleError 1 "List operation requested but no archive name provided. Please use '--list-all' for a list of all available archives."
@ -234,6 +243,11 @@ export TMPDIR="${borgBaseDir}/tmp"
### execute borg operations ### execute borg operations
# info operations
if [ "$operation" = 'info' ]; then
borg info ::"${archiveName}"
fi
# list operations # list operations
if [ "$operation" = 'listall' ]; then if [ "$operation" = 'listall' ]; then
borg list borg list