2022-03-26 09:42:19 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
2019-10-15 11:34:48 +00:00
|
|
|
|
2022-03-26 09:42:19 +00:00
|
|
|
#[derive(Clone, Deserialize, Serialize)]
|
2022-09-09 12:59:38 +00:00
|
|
|
#[cfg_attr(
|
|
|
|
feature = "config-schema",
|
|
|
|
derive(schemars::JsonSchema),
|
|
|
|
schemars(deny_unknown_fields)
|
|
|
|
)]
|
2022-03-26 09:42:19 +00:00
|
|
|
#[serde(default)]
|
2019-10-15 11:34:48 +00:00
|
|
|
pub struct CmdDurationConfig<'a> {
|
|
|
|
pub min_time: i64,
|
2020-07-07 22:45:32 +00:00
|
|
|
pub format: &'a str,
|
|
|
|
pub style: &'a str,
|
2019-12-19 22:38:06 +00:00
|
|
|
pub show_milliseconds: bool,
|
2019-10-15 11:34:48 +00:00
|
|
|
pub disabled: bool,
|
2020-08-11 16:44:25 +00:00
|
|
|
pub show_notifications: bool,
|
|
|
|
pub min_time_to_notify: i64,
|
2022-01-29 21:56:55 +00:00
|
|
|
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
|
|
pub notification_timeout: Option<u32>,
|
2019-10-15 11:34:48 +00:00
|
|
|
}
|
|
|
|
|
2021-03-15 10:40:52 +00:00
|
|
|
impl<'a> Default for CmdDurationConfig<'a> {
|
|
|
|
fn default() -> Self {
|
2019-10-15 11:34:48 +00:00
|
|
|
CmdDurationConfig {
|
2019-12-19 22:38:06 +00:00
|
|
|
min_time: 2_000,
|
2020-07-07 22:45:32 +00:00
|
|
|
format: "took [$duration]($style) ",
|
2019-12-19 22:38:06 +00:00
|
|
|
show_milliseconds: false,
|
2020-07-07 22:45:32 +00:00
|
|
|
style: "yellow bold",
|
2019-10-15 11:34:48 +00:00
|
|
|
disabled: false,
|
2020-08-11 16:44:25 +00:00
|
|
|
show_notifications: false,
|
|
|
|
min_time_to_notify: 45_000,
|
2022-01-29 21:56:55 +00:00
|
|
|
notification_timeout: None,
|
2019-10-15 11:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|