Disable emojis/color on windows

This commit is contained in:
Malte Tammena 2021-10-24 17:53:38 +02:00
parent 869c3f789a
commit fd83b36907
2 changed files with 8 additions and 3 deletions

View file

@ -26,6 +26,7 @@ pub struct Args {
/// Use ascii characters only.
/// This does not prune non-ascii characters returned by the openmensa API.
#[cfg_attr(windows, doc = "Not available")]
#[structopt(long, env = "MENSA_ASCII_ONLY", global = true, takes_value = false)]
pub plain: bool,

View file

@ -84,8 +84,12 @@ macro_rules! color {
$what $(. $fn())+ .to_string()
}
ColorWhen::Automatic => {
$what.if_supports_color(Stream::Stdout,
|txt| txt $(. $fn().to_string())+).to_string()
// TODO: Colors don't seem to work on windows
#[cfg(not(windows))]
{ $what.if_supports_color(Stream::Stdout,
|txt| txt $(. $fn().to_string())+).to_string() }
#[cfg(windows)]
$what.to_string()
}
ColorWhen::Never => {
$what.to_string()
@ -100,7 +104,7 @@ macro_rules! color {
/// The former will be used unless the `--plain` flag is specified.
macro_rules! if_plain {
($fancy:expr, $plain:expr) => {
if crate::config::CONF.args.plain {
if cfg!(windows) || crate::config::CONF.args.plain {
$plain
} else {
$fancy