From ff71d6530df790c04ac7024e1a177962d3f4544c Mon Sep 17 00:00:00 2001 From: ayakael Date: Sun, 15 Apr 2018 22:05:35 -0400 Subject: [PATCH] [cmd_fsck] Now permits choice in what tests one does --- src/cmd_fsck | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/cmd_fsck b/src/cmd_fsck index 90d43e9..65fbe7f 100644 --- a/src/cmd_fsck +++ b/src/cmd_fsck @@ -12,13 +12,29 @@ cmd_fsck() { local GIT_DIR="${1}" - local TARGET="${2}" + local TARGET="${2}"; shift 2 + local cmdList=(${@}) local DB_FILE="${TARGET}/${_OPT_DB_FILE}" [[ ! -f "${DB_FILE}" ]] && return 3 [[ ! -d "${GIT_DIR}/.git" ]] && return 2 - chk_deployed_ids "${TARGET}" "${DB_FILE}" - chk_nonexistent_ids "${TARGET}" "${DB_FILE}" - chk_metadata "${GIT_DIR}" "${TARGET}" "${DB_FILE}" + case ${cmdList[@]} in + --deployed-ids) + chk_deployed_ids "${TARGET}" "${DB_FILE}" + ;; + + --non-existent-ids) + chk_nonexistent_ids "${TARGET}" "${DB_FILE}" + ;; + --metadata) + chk_metadata "${GIT_DIR}" "${TARGET}" "${DB_FILE}" + ;; + + *) + chk_deployed_ids "${TARGET}" "${DB_FILE}" + chk_nonexistent_ids "${TARGET}" "${DB_FILE}" + chk_metadata "${GIT_DIR}" "${TARGET}" "${DB_FILE}" + ;; + esac }