preflight checks

This commit is contained in:
Asif Bacchus 2020-03-26 02:35:30 -06:00
parent 3fc67f9fe3
commit 7838b0c6e0
2 changed files with 27 additions and 17 deletions

View File

@ -1,19 +1,3 @@
{
"bookmarks": [
{
"fsPath": "$ROOTPATH$/borghelper.sh",
"bookmarks": [
-1,
8,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1
]
}
]
"bookmarks": []
}

View File

@ -101,3 +101,29 @@ while [ $# -gt 0 ]; do
shift
done
### check parameter validity
# no operation
if [ -z "$operation" ]; then
consoleError 1 'Nothing to do!'
fi
# list without archive
if [ "$operation" = 'list' ] && [ -z "$archiveName" ]; then
consoleError 1 "List operation requested but no archive name provided. Please use '--list-all' for a list of all available archives."
fi
# restore with no path
if [ "$operation" = 'restore' ] && [ -z "$restorePath" ]; then
consoleError 1 "Restore operation requested but no restore path provided."
# restore with no archive
elif [ "$operation" = 'restore' ] && [ -z "$archiveName" ]; then
consoleError 1 "Restore operation requested but no archive name provided."
fi
# file provided but no archive
if [ "$fileName" ] && [ -z "$archiveName" ]; then
consoleError 1 "Filename specified without an associated archive name."
fi