From f162d641a71b95f7febab0c04aba7d64182df38b Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Mon, 7 Apr 2025 14:17:19 +0100 Subject: feat: support storing, syncing and executing scripts (#2644) * feat: add atuin-scripts crate * initial * define record types * wip * wip * mvp * add show command, make stdin work * rewrite execution to use shebang and script file ALWAYS * rename show -> get, allow fetching script only * fmt * clippy * a bunch of fixes to the edits * update lock * variables * fmt * clippy * pr feedback * fmt --- crates/atuin-client/Cargo.toml | 2 +- crates/atuin-client/src/settings.rs | 4 ++++ crates/atuin-client/src/settings/scripts.rs | 17 +++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 crates/atuin-client/src/settings/scripts.rs (limited to 'crates/atuin-client') diff --git a/crates/atuin-client/Cargo.toml b/crates/atuin-client/Cargo.toml index eccc13c2..a4f2fb24 100644 --- a/crates/atuin-client/Cargo.toml +++ b/crates/atuin-client/Cargo.toml @@ -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 } diff --git a/crates/atuin-client/src/settings.rs b/crates/atuin-client/src/settings.rs index 91ccb6b8..7af24d90 100644 --- a/crates/atuin-client/src/settings.rs +++ b/crates/atuin-client/src/settings.rs @@ -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 { @@ -515,6 +516,9 @@ pub struct Settings { #[serde(default)] pub theme: Theme, + + #[serde(default)] + pub scripts: scripts::Settings, } impl Settings { diff --git a/crates/atuin-client/src/settings/scripts.rs b/crates/atuin-client/src/settings/scripts.rs new file mode 100644 index 00000000..e9d66c93 --- /dev/null +++ b/crates/atuin-client/src/settings/scripts.rs @@ -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(), + } + } +} -- cgit v1.3.1