aboutsummaryrefslogtreecommitdiffstats
path: root/crates
diff options
context:
space:
mode:
authorEllie Huxtable <ellie@atuin.sh>2026-01-27 13:51:41 -0800
committerGitHub <noreply@github.com>2026-01-27 13:51:41 -0800
commit3ed6e6b8776185a57f5ce29a28b7b60174385ac1 (patch)
tree22f6c8edb45874fd2c18ec837f3e419e1bfdce1a /crates
parentfix: do not set ATUIN_SESSION if it is already set (#3107) (diff)
downloadatuin-3ed6e6b8776185a57f5ce29a28b7b60174385ac1.zip
chore(deps): cleanup of dep versions (#3106)
Ensure we aren't using multiple versions, etc <!-- Thank you for making a PR! Bug fixes are always welcome, but if you're adding a new feature or changing an existing one, we'd really appreciate if you open an issue, post on the forum, or drop in on Discord --> ## Checks - [ ] I am happy for maintainers to push small adjustments to this PR, to speed up the review cycle - [ ] I have checked that there are no existing pull requests for the same thing
Diffstat (limited to 'crates')
-rw-r--r--crates/atuin-client/Cargo.toml5
-rw-r--r--crates/atuin-client/src/theme.rs201
-rw-r--r--crates/atuin-common/Cargo.toml2
-rw-r--r--crates/atuin-common/src/api.rs8
4 files changed, 106 insertions, 110 deletions
diff --git a/crates/atuin-client/Cargo.toml b/crates/atuin-client/Cargo.toml
index e2ad5a00..c727f019 100644
--- a/crates/atuin-client/Cargo.toml
+++ b/crates/atuin-client/Cargo.toml
@@ -70,9 +70,8 @@ tiny-bip39 = "=1.0.0"
# theme
crossterm = { version = "0.29.0", features = ["serde"] }
palette = { version = "0.7.5", features = ["serializing"] }
-lazy_static = "1.4.0"
-strum_macros = "0.26.3"
-strum = { version = "0.26.2", features = ["strum_macros"] }
+strum_macros = "0.27"
+strum = { version = "0.27", features = ["strum_macros"] }
[dev-dependencies]
tokio = { version = "1", features = ["full"] }
diff --git a/crates/atuin-client/src/theme.rs b/crates/atuin-client/src/theme.rs
index 76ddbb22..a277ac13 100644
--- a/crates/atuin-client/src/theme.rs
+++ b/crates/atuin-client/src/theme.rs
@@ -1,5 +1,4 @@
use config::{Config, File as ConfigFile, FileFormat};
-use lazy_static::lazy_static;
use log;
use palette::named;
use serde::{Deserialize, Serialize};
@@ -8,6 +7,7 @@ use std::collections::HashMap;
use std::error;
use std::io::{Error, ErrorKind};
use std::path::PathBuf;
+use std::sync::LazyLock;
use strum_macros;
static DEFAULT_MAX_DEPTH: u8 = 10;
@@ -241,122 +241,123 @@ impl StyleFactory {
// Built-in themes. Rather than having extra files added before any theming
// is available, this gives a couple of basic options, demonstrating the use
// of themes: autumn and marine
-lazy_static! {
- static ref ALERT_TYPES: HashMap<log::Level, Meaning> = {
- HashMap::from([
- (log::Level::Info, Meaning::AlertInfo),
- (log::Level::Warn, Meaning::AlertWarn),
- (log::Level::Error, Meaning::AlertError),
- ])
- };
- static ref MEANING_FALLBACKS: HashMap<Meaning, Meaning> = {
+static ALERT_TYPES: LazyLock<HashMap<log::Level, Meaning>> = LazyLock::new(|| {
+ HashMap::from([
+ (log::Level::Info, Meaning::AlertInfo),
+ (log::Level::Warn, Meaning::AlertWarn),
+ (log::Level::Error, Meaning::AlertError),
+ ])
+});
+
+static MEANING_FALLBACKS: LazyLock<HashMap<Meaning, Meaning>> = LazyLock::new(|| {
+ HashMap::from([
+ (Meaning::Guidance, Meaning::AlertInfo),
+ (Meaning::Annotation, Meaning::AlertInfo),
+ (Meaning::Title, Meaning::Important),
+ ])
+});
+
+static DEFAULT_THEME: LazyLock<Theme> = LazyLock::new(|| {
+ Theme::new(
+ "default".to_string(),
+ None,
HashMap::from([
- (Meaning::Guidance, Meaning::AlertInfo),
- (Meaning::Annotation, Meaning::AlertInfo),
- (Meaning::Title, Meaning::Important),
- ])
- };
- static ref DEFAULT_THEME: Theme = {
- Theme::new(
- "default".to_string(),
- None,
+ (
+ Meaning::AlertError,
+ StyleFactory::from_fg_color(Color::DarkRed),
+ ),
+ (
+ Meaning::AlertWarn,
+ StyleFactory::from_fg_color(Color::DarkYellow),
+ ),
+ (
+ Meaning::AlertInfo,
+ StyleFactory::from_fg_color(Color::DarkGreen),
+ ),
+ (
+ Meaning::Annotation,
+ StyleFactory::from_fg_color(Color::DarkGrey),
+ ),
+ (
+ Meaning::Guidance,
+ StyleFactory::from_fg_color(Color::DarkBlue),
+ ),
+ (
+ Meaning::Important,
+ StyleFactory::from_fg_color_and_attributes(
+ Color::White,
+ Attributes::from(Attribute::Bold),
+ ),
+ ),
+ (Meaning::Muted, StyleFactory::from_fg_color(Color::Grey)),
+ (Meaning::Base, ContentStyle::default()),
+ ]),
+ )
+});
+
+static BUILTIN_THEMES: LazyLock<HashMap<&'static str, Theme>> = LazyLock::new(|| {
+ HashMap::from([
+ ("default", HashMap::new()),
+ (
+ "(none)",
+ HashMap::from([
+ (Meaning::AlertError, ContentStyle::default()),
+ (Meaning::AlertWarn, ContentStyle::default()),
+ (Meaning::AlertInfo, ContentStyle::default()),
+ (Meaning::Annotation, ContentStyle::default()),
+ (Meaning::Guidance, ContentStyle::default()),
+ (Meaning::Important, ContentStyle::default()),
+ (Meaning::Muted, ContentStyle::default()),
+ (Meaning::Base, ContentStyle::default()),
+ ]),
+ ),
+ (
+ "autumn",
HashMap::from([
(
Meaning::AlertError,
- StyleFactory::from_fg_color(Color::DarkRed),
+ StyleFactory::known_fg_string("saddlebrown"),
),
(
Meaning::AlertWarn,
- StyleFactory::from_fg_color(Color::DarkYellow),
- ),
- (
- Meaning::AlertInfo,
- StyleFactory::from_fg_color(Color::DarkGreen),
+ StyleFactory::known_fg_string("darkorange"),
),
+ (Meaning::AlertInfo, StyleFactory::known_fg_string("gold")),
(
Meaning::Annotation,
StyleFactory::from_fg_color(Color::DarkGrey),
),
+ (Meaning::Guidance, StyleFactory::known_fg_string("brown")),
+ ]),
+ ),
+ (
+ "marine",
+ HashMap::from([
(
- Meaning::Guidance,
- StyleFactory::from_fg_color(Color::DarkBlue),
+ Meaning::AlertError,
+ StyleFactory::known_fg_string("yellowgreen"),
),
+ (Meaning::AlertWarn, StyleFactory::known_fg_string("cyan")),
(
- Meaning::Important,
- StyleFactory::from_fg_color_and_attributes(
- Color::White,
- Attributes::from(Attribute::Bold),
- ),
+ Meaning::AlertInfo,
+ StyleFactory::known_fg_string("turquoise"),
),
- (Meaning::Muted, StyleFactory::from_fg_color(Color::Grey)),
- (Meaning::Base, ContentStyle::default()),
+ (
+ Meaning::Annotation,
+ StyleFactory::known_fg_string("steelblue"),
+ ),
+ (
+ Meaning::Base,
+ StyleFactory::known_fg_string("lightsteelblue"),
+ ),
+ (Meaning::Guidance, StyleFactory::known_fg_string("teal")),
]),
- )
- };
- static ref BUILTIN_THEMES: HashMap<&'static str, Theme> = {
- HashMap::from([
- ("default", HashMap::new()),
- (
- "(none)",
- HashMap::from([
- (Meaning::AlertError, ContentStyle::default()),
- (Meaning::AlertWarn, ContentStyle::default()),
- (Meaning::AlertInfo, ContentStyle::default()),
- (Meaning::Annotation, ContentStyle::default()),
- (Meaning::Guidance, ContentStyle::default()),
- (Meaning::Important, ContentStyle::default()),
- (Meaning::Muted, ContentStyle::default()),
- (Meaning::Base, ContentStyle::default()),
- ]),
- ),
- (
- "autumn",
- HashMap::from([
- (
- Meaning::AlertError,
- StyleFactory::known_fg_string("saddlebrown"),
- ),
- (
- Meaning::AlertWarn,
- StyleFactory::known_fg_string("darkorange"),
- ),
- (Meaning::AlertInfo, StyleFactory::known_fg_string("gold")),
- (
- Meaning::Annotation,
- StyleFactory::from_fg_color(Color::DarkGrey),
- ),
- (Meaning::Guidance, StyleFactory::known_fg_string("brown")),
- ]),
- ),
- (
- "marine",
- HashMap::from([
- (
- Meaning::AlertError,
- StyleFactory::known_fg_string("yellowgreen"),
- ),
- (Meaning::AlertWarn, StyleFactory::known_fg_string("cyan")),
- (
- Meaning::AlertInfo,
- StyleFactory::known_fg_string("turquoise"),
- ),
- (
- Meaning::Annotation,
- StyleFactory::known_fg_string("steelblue"),
- ),
- (
- Meaning::Base,
- StyleFactory::known_fg_string("lightsteelblue"),
- ),
- (Meaning::Guidance, StyleFactory::known_fg_string("teal")),
- ]),
- ),
- ])
- .iter()
- .map(|(name, theme)| (*name, Theme::from_map(name.to_string(), None, theme)))
- .collect()
- };
-}
+ ),
+ ])
+ .iter()
+ .map(|(name, theme)| (*name, Theme::from_map(name.to_string(), None, theme)))
+ .collect()
+});
// To avoid themes being repeatedly loaded, we store them in a theme manager
pub struct ThemeManager {
diff --git a/crates/atuin-common/Cargo.toml b/crates/atuin-common/Cargo.toml
index 2ca4aa67..d65bdc68 100644
--- a/crates/atuin-common/Cargo.toml
+++ b/crates/atuin-common/Cargo.toml
@@ -26,7 +26,5 @@ sysinfo = "0.30.7"
base64 = { workspace = true }
getrandom = "0.2"
-lazy_static = "1.4.0"
-
[dev-dependencies]
pretty_assertions = { workspace = true }
diff --git a/crates/atuin-common/src/api.rs b/crates/atuin-common/src/api.rs
index 1aaf9859..973bdc8e 100644
--- a/crates/atuin-common/src/api.rs
+++ b/crates/atuin-common/src/api.rs
@@ -1,17 +1,15 @@
-use lazy_static::lazy_static;
use semver::Version;
use serde::{Deserialize, Serialize};
use std::borrow::Cow;
+use std::sync::LazyLock;
use time::OffsetDateTime;
// the usage of X- has been deprecated for quite along time, it turns out
pub static ATUIN_HEADER_VERSION: &str = "Atuin-Version";
pub static ATUIN_CARGO_VERSION: &str = env!("CARGO_PKG_VERSION");
-lazy_static! {
- pub static ref ATUIN_VERSION: Version =
- Version::parse(ATUIN_CARGO_VERSION).expect("failed to parse self semver");
-}
+pub static ATUIN_VERSION: LazyLock<Version> =
+ LazyLock::new(|| Version::parse(ATUIN_CARGO_VERSION).expect("failed to parse self semver"));
#[derive(Debug, Serialize, Deserialize)]
pub struct UserResponse {