feat(cmd_duration): make notify feature optional (compat with nix darwin) (#3855)

This commit is contained in:
Yt 2022-04-12 06:07:36 -04:00 committed by GitHub
parent 59fc274fb7
commit efaab49e47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View File

@ -30,9 +30,10 @@ The minimal, blazing-fast, and infinitely customizable prompt for any shell! ☄
"""
[features]
default = ["battery"]
default = ["battery", "notify"]
battery = ["starship-battery"]
config-schema = ["schemars"]
notify = ["notify-rust"]
[dependencies]
ansi_term = "0.12.1"
@ -47,7 +48,9 @@ git2 = { version = "0.14.2", default-features = false }
indexmap = { version = "1.8.1", features = ["serde"] }
local_ipaddress = "0.1.3"
log = { version = "0.4.16", features = ["std"] }
notify-rust = "4.5.8"
# nofity-rust is optional (on by default) because the crate doesn't currently build for darwin with nix
# see: https://github.com/NixOS/nixpkgs/issues/160876
notify-rust = { version = "4.5.8", optional = true }
once_cell = "1.10.0"
open = "2.1.1"
os_info = "3.2.0"

View File

@ -51,6 +51,16 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
Some(undistract_me(module, &config, elapsed))
}
#[cfg(not(feature = "notify"))]
fn undistract_me<'a, 'b>(
module: Module<'a>,
_config: &'b CmdDurationConfig,
_elapsed: u128,
) -> Module<'a> {
module
}
#[cfg(feature = "notify")]
fn undistract_me<'a, 'b>(
module: Module<'a>,
config: &'b CmdDurationConfig,