diff options
Diffstat (limited to 'atuin-client')
| -rw-r--r-- | atuin-client/src/history.rs | 4 | ||||
| -rw-r--r-- | atuin-client/src/settings.rs | 16 |
2 files changed, 18 insertions, 2 deletions
diff --git a/atuin-client/src/history.rs b/atuin-client/src/history.rs index 0147e25b..3dfa5c52 100644 --- a/atuin-client/src/history.rs +++ b/atuin-client/src/history.rs @@ -362,7 +362,7 @@ mod tests { let settings = Settings { cwd_filter: RegexSet::new(["^/supasecret"]).unwrap(), history_filter: RegexSet::new(["^psql"]).unwrap(), - ..Settings::default() + ..Settings::utc() }; let normal_command: History = History::capture() @@ -411,7 +411,7 @@ mod tests { fn disable_secrets() { let settings = Settings { secrets_filter: false, - ..Settings::default() + ..Settings::utc() }; let stripe_key: History = History::capture() diff --git a/atuin-client/src/settings.rs b/atuin-client/src/settings.rs index 7abacd0d..f4c47c64 100644 --- a/atuin-client/src/settings.rs +++ b/atuin-client/src/settings.rs @@ -155,6 +155,11 @@ impl FromStr for Timezone { return Ok(Self(offset)); } + if matches!(s.to_lowercase().as_str(), "0" | "utc") { + let offset = UtcOffset::UTC; + return Ok(Self(offset)); + } + // offset from UTC if let Ok(offset) = UtcOffset::parse(s, OFFSET_FMT) { return Ok(Self(offset)); @@ -355,6 +360,17 @@ pub struct Settings { } impl Settings { + pub fn utc() -> Self { + Self::builder() + .expect("Could not build default") + .set_override("timezone", "0") + .expect("failed to override timezone with UTC") + .build() + .expect("Could not build config") + .try_deserialize() + .expect("Could not deserialize config") + } + fn save_to_data_dir(filename: &str, value: &str) -> Result<()> { let data_dir = atuin_common::utils::data_dir(); let data_dir = data_dir.as_path(); |
