aboutsummaryrefslogtreecommitdiffstats
path: root/crates/atuin-history
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-06-11 00:54:30 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-06-11 00:54:30 +0200
commit5c39e7cf284a1f6e9a1657f2deb44e359fc47eb8 (patch)
treec64baa8d5866c8e339eaf660dd3f94f30a3f7d8a /crates/atuin-history
parentchore: Somewhat simplify sync code (diff)
downloadatuin-5c39e7cf284a1f6e9a1657f2deb44e359fc47eb8.zip
chore: Move everything into one big crate
That helps remove duplicated code and rustc/cargo will now also show dead code correctly.
Diffstat (limited to '')
-rw-r--r--crates/atuin-history/Cargo.toml30
-rw-r--r--crates/atuin-history/benches/smart_sort.rs35
-rw-r--r--crates/turtle/src/atuin_history/mod.rs (renamed from crates/atuin-history/src/lib.rs)0
-rw-r--r--crates/turtle/src/atuin_history/sort.rs (renamed from crates/atuin-history/src/sort.rs)2
-rw-r--r--crates/turtle/src/atuin_history/stats.rs (renamed from crates/atuin-history/src/stats.rs)6
5 files changed, 4 insertions, 69 deletions
diff --git a/crates/atuin-history/Cargo.toml b/crates/atuin-history/Cargo.toml
deleted file mode 100644
index 50831a0b..00000000
--- a/crates/atuin-history/Cargo.toml
+++ /dev/null
@@ -1,30 +0,0 @@
-[package]
-name = "atuin-history"
-description = "The history crate for Atuin"
-edition = "2024"
-version = { workspace = true }
-
-authors.workspace = true
-rust-version.workspace = true
-license.workspace = true
-homepage.workspace = true
-repository.workspace = true
-readme.workspace = true
-
-# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
-
-[dependencies]
-atuin-client = { path = "../atuin-client", version = "18.16.1" }
-
-time = { workspace = true }
-serde = { workspace = true }
-crossterm = { workspace = true, features = ["use-dev-tty"] }
-unicode-segmentation = "1.11.0"
-
-[dev-dependencies]
-divan = "0.1.14"
-rand = { workspace = true }
-
-[[bench]]
-name = "smart_sort"
-harness = false
diff --git a/crates/atuin-history/benches/smart_sort.rs b/crates/atuin-history/benches/smart_sort.rs
deleted file mode 100644
index a78064de..00000000
--- a/crates/atuin-history/benches/smart_sort.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-use atuin_client::history::History;
-use atuin_history::sort::sort;
-
-use rand::Rng;
-
-fn main() {
- // Run registered benchmarks.
- divan::main();
-}
-
-// Smart sort usually runs on 200 entries, test on a few sizes
-#[divan::bench(args=[100, 200, 400, 800, 1600, 10000])]
-fn smart_sort(lines: usize) {
- // benchmark a few different sizes of "history"
- // first we need to generate some history. This will use a whole bunch of memory, sorry
- let mut rng = rand::thread_rng();
- let now = time::OffsetDateTime::now_utc().unix_timestamp();
-
- let possible_commands = ["echo", "ls", "cd", "grep", "atuin", "curl"];
- let mut commands = Vec::<History>::with_capacity(lines);
-
- for _ in 0..lines {
- let command = possible_commands[rng.gen_range(0..possible_commands.len())];
-
- let command = History::import()
- .command(command)
- .timestamp(time::OffsetDateTime::from_unix_timestamp(rng.gen_range(0..now)).unwrap())
- .build()
- .into();
-
- commands.push(command);
- }
-
- let _ = sort("curl", commands);
-}
diff --git a/crates/atuin-history/src/lib.rs b/crates/turtle/src/atuin_history/mod.rs
index e7b33916..e7b33916 100644
--- a/crates/atuin-history/src/lib.rs
+++ b/crates/turtle/src/atuin_history/mod.rs
diff --git a/crates/atuin-history/src/sort.rs b/crates/turtle/src/atuin_history/sort.rs
index 022865a2..b162c810 100644
--- a/crates/atuin-history/src/sort.rs
+++ b/crates/turtle/src/atuin_history/sort.rs
@@ -1,4 +1,4 @@
-use atuin_client::history::History;
+use crate::atuin_client::history::History;
type ScoredHistory = (f64, History);
diff --git a/crates/atuin-history/src/stats.rs b/crates/turtle/src/atuin_history/stats.rs
index fedb1487..e47d6c8e 100644
--- a/crates/atuin-history/src/stats.rs
+++ b/crates/turtle/src/atuin_history/stats.rs
@@ -4,7 +4,7 @@ use crossterm::style::{Color, ResetColor, SetAttribute, SetForegroundColor};
use serde::{Deserialize, Serialize};
use unicode_segmentation::UnicodeSegmentation;
-use atuin_client::{history::History, settings::Settings, theme::Meaning, theme::Theme};
+use crate::atuin_client::{history::History, settings::Settings, theme::Meaning, theme::Theme};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Stats {
@@ -299,8 +299,8 @@ pub fn compute(
#[cfg(test)]
mod tests {
- use atuin_client::history::History;
- use atuin_client::settings::Settings;
+ use crate::atuin_client::history::History;
+ use crate::atuin_client::settings::Settings;
use time::OffsetDateTime;
use super::compute;