Skip to content

Commit f82011e

Browse files
committed
Enable image backends on macOS
1 parent 37379a5 commit f82011e

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

Diff for: Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ error-chain = "0.12"
3535
[target.'cfg(windows)'.dependencies]
3636
ansi_term = "0.12"
3737

38-
[target.'cfg(target_os = "linux")'.dependencies]
38+
[target.'cfg(not(target_os = "windows"))'.dependencies]
3939
libc = "0.2.79"
4040
base64 = "0.13.0"
4141

Diff for: src/onefetch/cli.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ pub struct Cli {
2626
impl Cli {
2727
/// Build `Options` from command line arguments.
2828
pub fn new() -> Result<Self> {
29-
#[cfg(target_os = "linux")]
29+
#[cfg(not(target_os = "windows"))]
3030
let possible_backends = ["kitty", "sixel"];
31-
#[cfg(not(target_os = "linux"))]
31+
#[cfg(target_os = "windows")]
3232
let possible_backends = [];
3333

3434
let matches = App::new(crate_name!())

Diff for: src/onefetch/image_backends/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
use image::DynamicImage;
22

3-
#[cfg(target_os = "linux")]
3+
#[cfg(not(target_os = "windows"))]
44
pub mod kitty;
5-
#[cfg(target_os = "linux")]
5+
#[cfg(not(target_os = "windows"))]
66
pub mod sixel;
77

88
pub trait ImageBackend {
99
fn add_image(&self, lines: Vec<String>, image: &DynamicImage) -> String;
1010
}
1111

12-
#[cfg(target_os = "linux")]
12+
#[cfg(not(target_os = "windows"))]
1313
pub fn get_best_backend() -> Option<Box<dyn ImageBackend>> {
1414
if kitty::KittyBackend::supported() {
1515
Some(Box::new(kitty::KittyBackend::new()))
@@ -21,18 +21,18 @@ pub fn get_best_backend() -> Option<Box<dyn ImageBackend>> {
2121
}
2222

2323
pub fn get_image_backend(backend_name: &str) -> Option<Box<dyn ImageBackend>> {
24-
#[cfg(target_os = "linux")]
24+
#[cfg(not(target_os = "windows"))]
2525
let backend = Some(match backend_name {
2626
"kitty" => Box::new(kitty::KittyBackend::new()) as Box<dyn ImageBackend>,
2727
"sixel" => Box::new(sixel::SixelBackend::new()) as Box<dyn ImageBackend>,
2828
_ => unreachable!(),
2929
});
30-
#[cfg(not(target_os = "linux"))]
30+
#[cfg(target_os = "windows")]
3131
let backend = None;
3232
backend
3333
}
3434

35-
#[cfg(not(target_os = "linux"))]
35+
#[cfg(target_os = "windows")]
3636
pub fn get_best_backend() -> Option<Box<dyn ImageBackend>> {
3737
None
3838
}

0 commit comments

Comments
 (0)