Skip to content
Merged
33 changes: 33 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ thiserror = "1.0"
rustix = { version = "0.38.34", features = ["process", "fs"] }
tower = "0.4"
tracing = "0.1"
sql-builder = "3"
tempfile = { version = "3.19" }
minijinja = "2.9.0"

[workspace.dependencies.tracing-subscriber]
version = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion crates/atuin-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ minspan = "0.1.1"
regex = "1.10.5"
serde_regex = "1.1.0"
fs-err = { workspace = true }
sql-builder = "3"
sql-builder = { workspace = true }
memchr = "2.7"
rmp = { version = "0.8.14" }
typed-builder = { workspace = true }
Expand Down
4 changes: 4 additions & 0 deletions crates/atuin-client/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub const HOST_ID_FILENAME: &str = "host_id";
static EXAMPLE_CONFIG: &str = include_str!("../config.toml");

mod dotfiles;
mod scripts;

#[derive(Clone, Debug, Deserialize, Copy, ValueEnum, PartialEq, Serialize)]
pub enum SearchMode {
Expand Down Expand Up @@ -515,6 +516,9 @@ pub struct Settings {

#[serde(default)]
pub theme: Theme,

#[serde(default)]
pub scripts: scripts::Settings,
}

impl Settings {
Expand Down
17 changes: 17 additions & 0 deletions crates/atuin-client/src/settings/scripts.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use serde::{Deserialize, Serialize};

#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Settings {
pub database_path: String,
}

impl Default for Settings {
fn default() -> Self {
let dir = atuin_common::utils::data_dir();
let path = dir.join("scripts.db");

Self {
database_path: path.to_string_lossy().to_string(),
}
}
}
33 changes: 33 additions & 0 deletions crates/atuin-scripts/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[package]
name = "atuin-scripts"
edition = "2024"
version = { workspace = true }
description = "The scripts crate for Atuin"

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.5.0-beta.1" }
atuin-common = { path = "../atuin-common", version = "18.5.0-beta.1" }

tracing = { workspace = true }
tracing-subscriber = { workspace = true }
rmp = { version = "0.8.14" }
uuid = { workspace = true }
eyre = { workspace = true }
tokio = { workspace = true }
serde = { workspace = true }
typed-builder = { workspace = true }
pretty_assertions = { workspace = true }
sql-builder = { workspace = true }
sqlx = { workspace = true }
tempfile = { workspace = true }
minijinja = { workspace = true }
serde_json = { workspace = true }
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DROP TABLE scripts;
DROP TABLE script_tags;
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- Add up migration script here
CREATE TABLE scripts (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
description TEXT NOT NULL,
shebang TEXT NOT NULL,
script TEXT NOT NULL,
inserted_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
);

CREATE TABLE script_tags (
id INTEGER PRIMARY KEY,
script_id TEXT NOT NULL,
tag TEXT NOT NULL
);

CREATE UNIQUE INDEX idx_script_tags ON script_tags (script_id, tag);
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Add down migration script here
alter table scripts drop index name_uniq_idx;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Add up migration script here
create unique index name_uniq_idx ON scripts(name);
Loading
Loading