From cc2aa6524dd9334f0d6d1af71f71d37d6725f345 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Sun, 4 Feb 2024 20:24:43 +0100 Subject: [PATCH] feat: disable auto record store init (#1671) I think this makes more sense as a manual action --- atuin/src/command/client/history.rs | 13 ++++++++++++- atuin/src/command/client/sync.rs | 6 ++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/atuin/src/command/client/history.rs b/atuin/src/command/client/history.rs index 29a0bdf3..e9ebaec1 100644 --- a/atuin/src/command/client/history.rs +++ b/atuin/src/command/client/history.rs @@ -32,7 +32,9 @@ use super::search::format_duration_into; #[command(infer_subcommands = true)] pub enum Cmd { /// Begins a new command in the history - Start { command: Vec }, + Start { + command: Vec, + }, /// Finishes a new command in the history (adds time, exit code) End { @@ -89,6 +91,8 @@ pub enum Cmd { #[arg(long, short)] format: Option, }, + + InitStore, } #[derive(Clone, Copy, Debug)] @@ -375,6 +379,11 @@ impl Cmd { Ok(()) } + async fn init_store(&self, db: &impl Database, history_store: HistoryStore) -> Result<()> { + let context = current_context(); + history_store.init_store(context, db).await + } + pub async fn run( self, settings: &Settings, @@ -431,6 +440,8 @@ impl Cmd { Ok(()) } + + Self::InitStore => self.init_store(db, history_store).await, } } } diff --git a/atuin/src/command/client/sync.rs b/atuin/src/command/client/sync.rs index a7d57158..67840ced 100644 --- a/atuin/src/command/client/sync.rs +++ b/atuin/src/command/client/sync.rs @@ -2,7 +2,7 @@ use clap::Subcommand; use eyre::{Result, WrapErr}; use atuin_client::{ - database::{current_context, Database}, + database::Database, encryption, history::store::HistoryStore, record::{sqlite_store::SqliteStore, store::Store, sync}, @@ -94,9 +94,7 @@ async fn run( if history_length as u64 > store_history_length { println!("History DB is longer than history record store"); println!("This happens when you used Atuin pre-record-store"); - - let context = current_context(); - history_store.init_store(context, db).await?; + println!("Run atuin history init-store to correct this"); println!("\n"); }