Struct codespan_reporting::term::ColorArg
source · pub struct ColorArg(pub ColorChoice);
Expand description
A command line argument that configures the coloring of the output.
This can be used with command line argument parsers like clap
or structopt
.
Example
use codespan_reporting::term::termcolor::StandardStream;
use codespan_reporting::term::ColorArg;
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
#[structopt(name = "groovey-app")]
pub struct Opts {
/// Configure coloring of output
#[structopt(
long = "color",
default_value = "auto",
possible_values = ColorArg::VARIANTS,
case_insensitive = true,
)]
pub color: ColorArg,
}
let opts = Opts::from_args();
let writer = StandardStream::stderr(opts.color.into());
Tuple Fields§
§0: ColorChoice
Implementations§
Trait Implementations§
source§impl Into<ColorChoice> for ColorArg
impl Into<ColorChoice> for ColorArg
source§fn into(self) -> ColorChoice
fn into(self) -> ColorChoice
Converts this type into the (usually inferred) input type.