diff --git a/code-formatter/Makefile b/code-formatter/Makefile index 43d67b9..f6ccaf6 100644 --- a/code-formatter/Makefile +++ b/code-formatter/Makefile @@ -17,7 +17,7 @@ GIT_TAG = $(shell git describe --tags --exact-match 2>/dev/null) VERSION := $(or $(GIT_TAG),latest) -all : VERSION := 1.1.1 +all : VERSION := 1.1.2 all : build release .PHONY : all diff --git a/code-formatter/src/entry.sh b/code-formatter/src/entry.sh index 5ae95fa..b3f0325 100755 --- a/code-formatter/src/entry.sh +++ b/code-formatter/src/entry.sh @@ -32,6 +32,8 @@ main() { _version="${VERSION}" fi + __initVariables "$@" + __header "Code-Formatter [${_version}]" @@ -41,13 +43,11 @@ main() { case "${_cmd}" in process) - __initVariables "$@" source ${INCLUDES_PATH}/process.shinc process return $? ;; prettier) - __initVariables "$@" source ${INCLUDES_PATH}/formatters/prettier.shinc if [[ ${#CSS_FILES[@]} -ne 0 ]]; then __prettier ${CSS_FILES[@]} @@ -58,13 +58,11 @@ main() { return $? ;; csscomb) - __initVariables "$@" source ${INCLUDES_PATH}/formatters/csscomb.shinc __csscomb ${CSS_FILES[@]} return $? ;; php-cs-fixer) - __initVariables "$@" source ${INCLUDES_PATH}/formatters/php-cs-fixer.shinc __phpFixer return $? diff --git a/code-formatter/src/inc/functions.shinc b/code-formatter/src/inc/functions.shinc index 8ef325c..4eecc84 100755 --- a/code-formatter/src/inc/functions.shinc +++ b/code-formatter/src/inc/functions.shinc @@ -6,30 +6,35 @@ # Colors __color_green() { + [[ ${OMIT_COLORS} -eq 1 ]] && printf -- "%b" "$*" && return printf '\033[1;31;32m' printf -- "%b" "$*" printf '\033[0m' } __color_red() { + [[ ${OMIT_COLORS} -eq 1 ]] && printf -- "%b" "$*" && return printf '\033[1;31m' printf -- "%b" "$*" printf '\033[0m' } __color_red_bg() { + [[ ${OMIT_COLORS} -eq 1 ]] && printf -- "%b" "$*" && return printf '\033[1;41m' printf -- "%b" "$*" printf '\033[0m' } __color_white() { + [[ ${OMIT_COLORS} -eq 1 ]] && printf -- "%b" "$*" && return printf '\033[1;37;40m' printf -- "%b" "$*" printf '\033[0m' } __color_yellow() { + [[ ${OMIT_COLORS} -eq 1 ]] && printf -- "%b" "$*" && return printf '\033[1;31;33m' printf -- "%b" "$*" printf '\033[0m' diff --git a/code-formatter/src/inc/variables.shinc b/code-formatter/src/inc/variables.shinc index 4427c01..54cd6b5 100644 --- a/code-formatter/src/inc/variables.shinc +++ b/code-formatter/src/inc/variables.shinc @@ -11,6 +11,7 @@ PHP_FILES=() DRY_RUN=0 +OMIT_COLORS=0 VERBOSE=0 @@ -21,6 +22,9 @@ __initVariables() { --dry-run) DRY_RUN=1 ;; + --no-color) + OMIT_COLORS=1 + ;; --verbose) VERBOSE=1 ;;