@@ -207,6 +207,9 @@ process_cli_args() {
207
207
" -${SHORT_NAME[$i]} " | " --${FULL_NAME[$i]} " )
208
208
if [[ ! -z " ${2+x} " ]]; then
209
209
argvalue=" $2 "
210
+ # set true for arguments without value (e.g., '--force')
211
+ elif [[ " ${ARG_TYPE[$i]} " = " None" ]]; then
212
+ argvalue=" true"
210
213
else
211
214
argvalue=" None"
212
215
err " empty value for variable '--${FULL_NAME[$i]} '"
@@ -222,7 +225,11 @@ process_cli_args() {
222
225
ARG_VALUE[$i ]=" $argvalue "
223
226
ARG_IS_GIVEN[$i ]=" true"
224
227
CLI_ARGS_CNT=$(( CLI_ARGS_CNT + 1 ))
225
- shift 2
228
+ if [[ " ${ARG_TYPE[$i]} " = " None" ]]; then
229
+ shift 1
230
+ else
231
+ shift 2
232
+ fi
226
233
esac
227
234
fi
228
235
done
@@ -285,6 +292,8 @@ validate_arg_type() {
285
292
err " '$name ' = '$value ' => is not a '$type ' (${re} )"
286
293
exit 1
287
294
fi
295
+ elif [[ $type = " None" ]]; then
296
+ true
288
297
else
289
298
err " '$name ' = '$value ' => unknown argument type, validation error"
290
299
exit 1
@@ -826,11 +835,14 @@ update_nodes_json() {
826
835
SHORT_DIR=" ${prev_dir} "
827
836
828
837
# exit with error if epoch is not given and this is not first run
829
- if [[ " ${EPOCH} " = " None" ]]; then
838
+ if [[ " ${EPOCH} " = " None" ]] && [[ " $FORCE " != " true " ]] ; then
830
839
echo " ${BOLD} ERROR: epoch not given but directory already exist:${RESET} " >&2
831
- echo " ${JSON_REPORTS_DIR} " >&2
832
- echo " to avoid overwriting results of epoch '${BOLD}${prev_epoch}${RESET} ', please choice health check epoch with help of option '-e'" >&2
833
- echo " example:" >&2
840
+ echo " ${JSON_REPORTS_DIR} " >&2
841
+ echo >&2
842
+ echo " To avoid overwriting results of epoch '${BOLD}${prev_epoch}${RESET} ', please choice health check epoch with help of option '-e'" >&2
843
+ echo " or just use ${BOLD} --force${RESET} flag" >&2
844
+ echo >&2
845
+ echo " Example:" >&2
834
846
echo " ./${SCRIPT_NAME} ${ALL_ARGS} ${BOLD} -e %NUMBER%${RESET} " >&2
835
847
exit 1
836
848
fi
0 commit comments