diff --git a/Cargo.toml b/Cargo.toml index 0f347731b..d4108bd79 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,7 +35,7 @@ error-chain = "0.12" [target.'cfg(windows)'.dependencies] ansi_term = "0.12" -[target.'cfg(target_os = "linux")'.dependencies] +[target.'cfg(not(windows))'.dependencies] libc = "0.2.79" base64 = "0.13.0" diff --git a/src/onefetch/cli.rs b/src/onefetch/cli.rs index 17be3a997..9d5b95efa 100644 --- a/src/onefetch/cli.rs +++ b/src/onefetch/cli.rs @@ -26,9 +26,9 @@ pub struct Cli { impl Cli { /// Build `Options` from command line arguments. pub fn new() -> Result { - #[cfg(target_os = "linux")] + #[cfg(not(windows))] let possible_backends = ["kitty", "sixel"]; - #[cfg(not(target_os = "linux"))] + #[cfg(windows)] let possible_backends = []; let matches = App::new(crate_name!()) diff --git a/src/onefetch/image_backends/mod.rs b/src/onefetch/image_backends/mod.rs index 0fb37aa11..676004a58 100644 --- a/src/onefetch/image_backends/mod.rs +++ b/src/onefetch/image_backends/mod.rs @@ -1,15 +1,15 @@ use image::DynamicImage; -#[cfg(target_os = "linux")] +#[cfg(not(windows))] pub mod kitty; -#[cfg(target_os = "linux")] +#[cfg(not(windows))] pub mod sixel; pub trait ImageBackend { fn add_image(&self, lines: Vec, image: &DynamicImage) -> String; } -#[cfg(target_os = "linux")] +#[cfg(not(windows))] pub fn get_best_backend() -> Option> { if kitty::KittyBackend::supported() { Some(Box::new(kitty::KittyBackend::new())) @@ -21,18 +21,18 @@ pub fn get_best_backend() -> Option> { } pub fn get_image_backend(backend_name: &str) -> Option> { - #[cfg(target_os = "linux")] + #[cfg(not(windows))] let backend = Some(match backend_name { "kitty" => Box::new(kitty::KittyBackend::new()) as Box, "sixel" => Box::new(sixel::SixelBackend::new()) as Box, _ => unreachable!(), }); - #[cfg(not(target_os = "linux"))] + #[cfg(windows)] let backend = None; backend } -#[cfg(not(target_os = "linux"))] +#[cfg(windows)] pub fn get_best_backend() -> Option> { None }