feat: disable auto record store init (#1671)

I think this makes more sense as a manual action
This commit is contained in:
Ellie Huxtable 2024-02-04 20:24:43 +01:00 committed by GitHub
parent b7bb583d8d
commit cc2aa6524d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 5 deletions

View File

@ -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<String> },
Start {
command: Vec<String>,
},
/// Finishes a new command in the history (adds time, exit code)
End {
@ -89,6 +91,8 @@ pub enum Cmd {
#[arg(long, short)]
format: Option<String>,
},
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,
}
}
}

View File

@ -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");
}