Skip to content
Snippets Groups Projects
Commit 4f33d5de authored by Jens Steidl's avatar Jens Steidl :baby_chick:
Browse files

- refactor: added lists & new checks for some parameters

parent ae77be0b
No related branches found
No related tags found
No related merge requests found
Pipeline #5016 passed
...@@ -63,6 +63,12 @@ ...@@ -63,6 +63,12 @@
# expected programs: # expected programs:
# file, ... # file, ...
# PARAMETER VALUES LISTS
DELIMITER=","
MODE_LIST="auto,mediathek,fotothek,save,ddz,digas"
STAGE_LIST="current,upcoming,any"
FILES_MODE_LIST="sort,delete,nothing"
# DEFAULTS # DEFAULTS
WITH_DAEMON=0 WITH_DAEMON=0
WITH_DEBUG=0 WITH_DEBUG=0
...@@ -264,17 +270,12 @@ get_cli_args() { ...@@ -264,17 +270,12 @@ get_cli_args() {
;; ;;
esac esac
done done
if [[ "${FILES_MODE}" != "sort" ]] && [[ "${FILES_MODE}" != "delete" ]] && [[ "${FILES_MODE}" != "nothing" ]]; then if ! [[ "${FILES_MODE_LIST}" =~ (${DELIMITER}|^)${FILES_MODE}(${DELIMITER}|$) ]]; then
error "param --files-mode must be 'sort', 'delete' or 'nothing'!" error "param --files-mode value must be one of the following '${FILES_MODE_LIST}'!"
exit 1 exit 1
fi fi
if [[ "${MODE}" != "auto" ]] \ if ! [[ "${MODE_LIST}" =~ (${DELIMITER}|^)${MODE}(${DELIMITER}|$) ]]; then
&& [[ "${MODE}" != "mediathek" ]] \ error "param --mode value must be one of the following '${MODE_LIST}'!"
&& [[ "${MODE}" != "fotothek" ]] \
&& [[ "${MODE}" != "save" ]] \
&& [[ "${MODE}" != "ddz" ]] \
&& [[ "${MODE}" != "digas" ]]; then
error "param --mode must be 'auto', 'mediathek', 'fotothek', 'save', 'ddz' or 'digas'!"
exit 1 exit 1
fi fi
if [[ "${WITH_PIPE}" -eq 1 ]]; then if [[ "${WITH_PIPE}" -eq 1 ]]; then
...@@ -294,8 +295,8 @@ get_cli_args() { ...@@ -294,8 +295,8 @@ get_cli_args() {
error "param --daemon does only work with param --mode='delete' or --mode='nothing'!" error "param --daemon does only work with param --mode='delete' or --mode='nothing'!"
exit 1 exit 1
fi fi
if [[ "${STAGE}" != "current" ]] && [[ "${STAGE}" != "upcoming" ]] && [[ "${STAGE}" != "any" ]]; then if ! [[ "${STAGE_LIST}" =~ (${DELIMITER}|^)${STAGE}(${DELIMITER}|$) ]]; then
error "--param stage must be 'any', 'current' or 'upcoming'!" error "param --stage value must be one of the following '${STAGE_LIST}'!"
exit 1 exit 1
fi fi
if [[ ! -d "${WATCH_FOLDER}" ]]; then if [[ ! -d "${WATCH_FOLDER}" ]]; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment