Disable colors if "NO_COLOR" env variable present
This commit is contained in:
@@ -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
|
. /usr/local/share/bastille/colors.pre.sh
|
||||||
case "${bastille_colors_enable}" in
|
}
|
||||||
[Yy][Ee][Ss])
|
|
||||||
. /usr/local/share/bastille/colors.pre.sh
|
# If "NO_COLOR" environment variable is present, disable output colors.
|
||||||
;;
|
if ! export | grep -q "NO_COLOR"; then
|
||||||
*)
|
enable_color
|
||||||
COLOR_RED=
|
fi
|
||||||
COLOR_GREEN=
|
|
||||||
COLOR_YELLOW=
|
|
||||||
COLOR_RESET=
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Notify message on error, but do not exit
|
# Notify message on error, but do not exit
|
||||||
error_notify() {
|
error_notify() {
|
||||||
|
|||||||
Reference in New Issue
Block a user