From 7bd6f369e7d86701704871ffc45de28ad11df937 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Thu, 26 Mar 2020 04:43:27 -0600 Subject: [PATCH] add info operations --- .vscode/numbered-bookmarks.json | 6 +++--- borghelper.sh | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.vscode/numbered-bookmarks.json b/.vscode/numbered-bookmarks.json index 20eb39a..388c3b4 100644 --- a/.vscode/numbered-bookmarks.json +++ b/.vscode/numbered-bookmarks.json @@ -4,15 +4,15 @@ "fsPath": "$ROOTPATH$/borghelper.sh", "bookmarks": [ -1, - 243, + 257, + 151, -1, -1, -1, -1, -1, -1, - -1, - 61 + 84 ] } ] diff --git a/borghelper.sh b/borghelper.sh index 37d6bd9..1f070a1 100755 --- a/borghelper.sh +++ b/borghelper.sh @@ -82,6 +82,10 @@ while [ $# -gt 0 ]; do printf "\nStill working on the help text :-)\n\n" exit 0 ;; + -i|--info) + # show archive information + operation='info' + ;; -l|--list) # list contents of specific backup 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.' 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 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." @@ -234,6 +243,11 @@ export TMPDIR="${borgBaseDir}/tmp" ### execute borg operations +# info operations +if [ "$operation" = 'info' ]; then + borg info ::"${archiveName}" +fi + # list operations if [ "$operation" = 'listall' ]; then borg list