From 23359c835c63911339c63d4b6730e8489433babc Mon Sep 17 00:00:00 2001 From: ayakael Date: Thu, 29 Mar 2018 13:33:08 -0400 Subject: [PATCH] [cmd_exclude] Fixed syntax bugs, now outputs projected disk usage at end [cmd_include] Fixed syntax bugs, now outputs projected disk usage at end --- src/cmd_exclude | 8 ++++++-- src/cmd_include | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/cmd_exclude b/src/cmd_exclude index e245521..a61f375 100644 --- a/src/cmd_exclude +++ b/src/cmd_exclude @@ -19,11 +19,15 @@ cmd_exclude() { local GIT_DIR="${1}" local TARGET="${2}" local DB_FILE="${TARGET}/${_OPT_DB_FILE}"; shift 2 - local conditionList==("${@}") + local conditionList=("${@}") + echo ${conditionList[@]} for condition in ${conditionList[@]}; do _msg EXEC "Excluding all tracks that match the following condition: ${condition}" db_set ${GIT_DIR} ${DB_FILE} false "${condition}" - [[ $? -ne 0 ]] && { _msg WARN; return 1; } || { _msg OK; return 0; } + [[ $? -ne 0 ]] && { _msg WARN; } || { _msg OK; } done + local imageidList=($(awk 'BEGIN{FS="\t"}{if($1=="true"){print $2}}' ${DB_FILE} | awk '!seen[$0]++')) + local DU="$(print_imageid_du ${GIT_DIR} ${imageidList[@]})" + _msg ECHO "Current estimated disk usage: ${DU} bytes" } diff --git a/src/cmd_include b/src/cmd_include index 967fb39..31c3cfd 100644 --- a/src/cmd_include +++ b/src/cmd_include @@ -19,11 +19,15 @@ cmd_include() { local GIT_DIR="${1}" local TARGET="${2}" local DB_FILE="${TARGET}/${_OPT_DB_FILE}"; shift 2 - local conditionList==("${@}") + local conditionList=("${@}") for condition in ${conditionList[@]}; do _msg EXEC "Including all tracks that match the following condition: ${condition}" db_set ${GIT_DIR} ${DB_FILE} true "${condition}" - [[ $? -ne 0 ]] && { _msg WARN; return 1; } || { _msg OK; return 0; } + [[ $? -ne 0 ]] && { _msg WARN; } || { _msg OK; } done + local imageidList=($(awk 'BEGIN{FS="\t"}{if($1=="true"){print $2}}' ${DB_FILE} | awk '!seen[$0]++')) + local DU="$(print_imageid_du ${GIT_DIR} ${imageidList[@]})" + _msg ECHO "Current estimated disk usage: ${DU} bytes" + }