mirror of
https://github.com/MalteT/mensa.git
synced 2024-10-22 21:59:17 +02:00
Disable emojis/color on windows
This commit is contained in:
parent
869c3f789a
commit
fd83b36907
|
@ -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,
|
||||
|
||||
|
|
10
src/main.rs
10
src/main.rs
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue