#!/usr/bin/env bash
# core/mixins/no_color.mixin.sh
# Adds --no-color flag support to any command

_COMMAND_NO_COLOR=false

function command::mixin::no_color::register() {
  flag::register --no-color
}

function command::mixin::no_color::reset() {
  _COMMAND_NO_COLOR=false
}

function command::mixin::no_color::process() {
  [[ "$1" == "--no-color" ]] && _COMMAND_NO_COLOR=true && return 0
  return 1
}

# Public accessor
function command::no_color() { [[ "${_COMMAND_NO_COLOR:-false}" == "true" ]]; }