From 9685ff231269c157f01ca354d193a82e67e86bed Mon Sep 17 00:00:00 2001 From: Runji Wang Date: Sat, 30 Nov 2024 02:41:25 +0800 Subject: [PATCH] remove --memory Signed-off-by: Runji Wang --- src/main.rs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/main.rs b/src/main.rs index 84cd6673..5bcd010f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,18 +29,15 @@ use tracing_subscriber::prelude::*; #[derive(Parser, Debug)] #[clap(author, version, about, long_about = None)] struct Args { - /// Where to store the database files - #[clap()] - storage_path: Option, + /// The name of an RisingLight database. + /// A new database is created if the file does not previously exist. + #[clap(default_value = ":memory:")] + filename: String, /// File to execute. Can be either a SQL `sql` file or sqllogictest `slt` file. #[clap(short, long)] file: Option, - /// Whether to use in-memory engine - #[clap(long)] - memory: bool, - /// Control the output format /// - `text`: plain text /// - `human`: human readable format @@ -326,15 +323,12 @@ async fn main() -> Result<()> { minitrace::set_reporter(ConsoleReporter, Config::default()); } - let db = if args.memory { - info!("using memory engine"); + let db = if args.filename == ":memory:" { + info!("Connected to a transient in-memory database."); Database::new_in_memory() } else { - info!("using Secondary engine"); let mut options = SecondaryStorageOptions::default_for_cli(); - if let Some(path) = args.storage_path { - options.path = PathBuf::new().join(path); - } + options.path = PathBuf::new().join(args.filename); Database::new_on_disk(options).await };