mirror of
https://github.com/atuinsh/atuin.git
synced 2025-06-21 10:28:50 +02:00
feat: disable auto record store init (#1671)
I think this makes more sense as a manual action
This commit is contained in:
parent
b7bb583d8d
commit
cc2aa6524d
@ -32,7 +32,9 @@ use super::search::format_duration_into;
|
|||||||
#[command(infer_subcommands = true)]
|
#[command(infer_subcommands = true)]
|
||||||
pub enum Cmd {
|
pub enum Cmd {
|
||||||
/// Begins a new command in the history
|
/// 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)
|
/// Finishes a new command in the history (adds time, exit code)
|
||||||
End {
|
End {
|
||||||
@ -89,6 +91,8 @@ pub enum Cmd {
|
|||||||
#[arg(long, short)]
|
#[arg(long, short)]
|
||||||
format: Option<String>,
|
format: Option<String>,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
InitStore,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
@ -375,6 +379,11 @@ impl Cmd {
|
|||||||
Ok(())
|
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(
|
pub async fn run(
|
||||||
self,
|
self,
|
||||||
settings: &Settings,
|
settings: &Settings,
|
||||||
@ -431,6 +440,8 @@ impl Cmd {
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Self::InitStore => self.init_store(db, history_store).await,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ use clap::Subcommand;
|
|||||||
use eyre::{Result, WrapErr};
|
use eyre::{Result, WrapErr};
|
||||||
|
|
||||||
use atuin_client::{
|
use atuin_client::{
|
||||||
database::{current_context, Database},
|
database::Database,
|
||||||
encryption,
|
encryption,
|
||||||
history::store::HistoryStore,
|
history::store::HistoryStore,
|
||||||
record::{sqlite_store::SqliteStore, store::Store, sync},
|
record::{sqlite_store::SqliteStore, store::Store, sync},
|
||||||
@ -94,9 +94,7 @@ async fn run(
|
|||||||
if history_length as u64 > store_history_length {
|
if history_length as u64 > store_history_length {
|
||||||
println!("History DB is longer than history record store");
|
println!("History DB is longer than history record store");
|
||||||
println!("This happens when you used Atuin pre-record-store");
|
println!("This happens when you used Atuin pre-record-store");
|
||||||
|
println!("Run atuin history init-store to correct this");
|
||||||
let context = current_context();
|
|
||||||
history_store.init_store(context, db).await?;
|
|
||||||
|
|
||||||
println!("\n");
|
println!("\n");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user