mirror of
https://github.com/starship/starship.git
synced 2026-06-22 02:02:12 +07:00
feat(cmd_duration): Make notification timeout configurable (#3515)
* Allow customization of notification timeout
* Document new notification duration option
* Check for out-of-bounds timeout and correct it
* Implement ModuleConfig for u32
* Revert "Check for out-of-bounds timeout and correct it"
This reverts commit 52109ab5f7.
* Switch notification_timeout to u32
* Note notification_daemons might not honor timout
* Notification timeout defaults to daemon timeout
* Leave default value of notification_timeout blank in docs
This commit is contained in:
@@ -109,6 +109,23 @@ impl<'a> ModuleConfig<'a> for f64 {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ModuleConfig<'a> for u32 {
|
||||
fn from_config(config: &Value) -> Option<Self> {
|
||||
match config {
|
||||
Value::Integer(value) => {
|
||||
// Converting i64 to u32
|
||||
if *value > 0 && *value <= u32::MAX.into() {
|
||||
Some(*value as Self)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
Value::String(value) => value.parse::<Self>().ok(),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ModuleConfig<'a> for usize {
|
||||
fn from_config(config: &Value) -> Option<Self> {
|
||||
match config {
|
||||
|
||||
Reference in New Issue
Block a user