aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock61
-rw-r--r--Cargo.toml2
-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
6 files changed, 121 insertions, 158 deletions
diff --git a/Cargo.lock b/Cargo.lock
index b03d8623..fdd2f061 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -237,7 +237,7 @@ dependencies = [
"fuzzy-matcher",
"indicatif",
"interim",
- "itertools 0.13.0",
+ "itertools",
"log",
"norm",
"ratatui",
@@ -281,8 +281,7 @@ dependencies = [
"humantime",
"indicatif",
"interim",
- "itertools 0.13.0",
- "lazy_static",
+ "itertools",
"log",
"memchr",
"minspan",
@@ -303,8 +302,8 @@ dependencies = [
"shellexpand",
"sql-builder",
"sqlx",
- "strum 0.26.3",
- "strum_macros 0.26.4",
+ "strum",
+ "strum_macros",
"testing_logger",
"thiserror 1.0.69",
"time",
@@ -324,7 +323,6 @@ dependencies = [
"directories",
"eyre",
"getrandom 0.2.17",
- "lazy_static",
"pretty_assertions",
"semver",
"serde",
@@ -2291,15 +2289,6 @@ dependencies = [
[[package]]
name = "itertools"
-version = "0.13.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
-dependencies = [
- "either",
-]
-
-[[package]]
-name = "itertools"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
@@ -3331,9 +3320,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
-version = "1.0.106"
+version = "1.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
+checksum = "9695f8df41bb4f3d222c95a67532365f569318332d03d5f3f67f37b20e6ebdf0"
dependencies = [
"unicode-ident",
]
@@ -3355,7 +3344,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be769465445e8c1474e9c5dac2018218498557af32d9ed057325ec9a41ae81bf"
dependencies = [
"heck",
- "itertools 0.14.0",
+ "itertools",
"log",
"multimap",
"once_cell",
@@ -3375,7 +3364,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d"
dependencies = [
"anyhow",
- "itertools 0.14.0",
+ "itertools",
"proc-macro2",
"quote",
"syn 2.0.114",
@@ -3631,10 +3620,10 @@ dependencies = [
"compact_str",
"hashbrown 0.16.1",
"indoc",
- "itertools 0.14.0",
+ "itertools",
"kasuari",
"lru",
- "strum 0.27.2",
+ "strum",
"thiserror 2.0.18",
"unicode-segmentation",
"unicode-truncate",
@@ -3683,10 +3672,10 @@ dependencies = [
"hashbrown 0.16.1",
"indoc",
"instability",
- "itertools 0.14.0",
+ "itertools",
"line-clipping",
"ratatui-core",
- "strum 0.27.2",
+ "strum",
"time",
"unicode-segmentation",
"unicode-width 0.2.0",
@@ -4733,33 +4722,11 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "strum"
-version = "0.26.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06"
-dependencies = [
- "strum_macros 0.26.4",
-]
-
-[[package]]
-name = "strum"
version = "0.27.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf"
dependencies = [
- "strum_macros 0.27.2",
-]
-
-[[package]]
-name = "strum_macros"
-version = "0.26.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be"
-dependencies = [
- "heck",
- "proc-macro2",
- "quote",
- "rustversion",
- "syn 2.0.114",
+ "strum_macros",
]
[[package]]
@@ -5469,7 +5436,7 @@ version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16b380a1238663e5f8a691f9039c73e1cdae598a30e9855f541d29b08b53e9a5"
dependencies = [
- "itertools 0.14.0",
+ "itertools",
"unicode-segmentation",
"unicode-width 0.2.0",
]
diff --git a/Cargo.toml b/Cargo.toml
index e1f75a62..2c2b564e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -28,7 +28,7 @@ directories = "6.0.0"
eyre = "0.6"
fs-err = "3.1"
interim = { version = "0.2.0", features = ["time_0_3"] }
-itertools = "0.13.0"
+itertools = "0.14.0"
rand = { version = "0.8.5", features = ["std"] }
semver = "1.0.20"
serde = { version = "1.0.202", features = ["derive"] }
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 {