From 8068767773a3ae6558d7492d0de12b293c68fdab Mon Sep 17 00:00:00 2001 From: Timur Demin Date: Tue, 4 Jun 2019 01:28:57 +0500 Subject: [PATCH] Add a --help cmdline option --- backup.sh | 71 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 27 deletions(-) diff --git a/backup.sh b/backup.sh index 4bfe994..4009f45 100644 --- a/backup.sh +++ b/backup.sh @@ -90,31 +90,48 @@ backup_configs() { done } -# Check if the first command-line flag is `-a` and run all of the options if -# applicable, check for the other flags otherwise. -if [[ "${1}" != "-a" ]]; then - while [[ ! -z ${1} ]]; do - case ${1} in - "-d" | "--docker") - backup_docker - ;; - "-p" | "--postgres") - backup_postgres - ;; - "-c" | "--configs") - backup_configs - ;; - "-a") - die "-a cannot be specified after any other flags." - ;; - esac - shift - done -else - backup_configs - backup_docker - # backup_postgres - # This is commented out by default, as PostgreSQL backups might be - # preferable to run under a separate user. -fi +print_help() { + cat <