Disable colors if "NO_COLOR" env variable present

This commit is contained in:
JRGTH
2021-07-13 09:02:55 -04:00
parent 50c09d0359
commit 64cc7747c8

View File

@@ -28,21 +28,19 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
. /usr/local/etc/bastille/bastille.conf COLOR_RED=
COLOR_GREEN=
COLOR_YELLOW=
COLOR_RESET=
# Load text output colors if enabled in config enable_color() {
# else reset colors variables used by bastille
case "${bastille_colors_enable}" in
[Yy][Ee][Ss])
. /usr/local/share/bastille/colors.pre.sh . /usr/local/share/bastille/colors.pre.sh
;; }
*)
COLOR_RED= # If "NO_COLOR" environment variable is present, disable output colors.
COLOR_GREEN= if ! export | grep -q "NO_COLOR"; then
COLOR_YELLOW= enable_color
COLOR_RESET= fi
;;
esac
# Notify message on error, but do not exit # Notify message on error, but do not exit
error_notify() { error_notify() {