mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-18 17:14:20 +01:00
Add .copy CLI command
This commit is contained in:
@@ -713,6 +713,11 @@ impl Limbo {
|
||||
HeadersMode::Off => false,
|
||||
};
|
||||
}
|
||||
Command::Copy(args) => {
|
||||
if let Err(e) = self.conn.copy_db(&args.output_file) {
|
||||
let _ = self.writeln(e.to_string());
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,6 +143,11 @@ pub struct HeadersArgs {
|
||||
pub mode: HeadersMode,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Args)]
|
||||
pub struct CopyArgs {
|
||||
pub output_file: String,
|
||||
}
|
||||
|
||||
#[derive(ValueEnum, Copy, Clone, Debug, PartialEq, Eq)]
|
||||
pub enum HeadersMode {
|
||||
On,
|
||||
|
||||
@@ -9,7 +9,10 @@ use args::{
|
||||
use clap::Parser;
|
||||
use import::ImportArgs;
|
||||
|
||||
use crate::input::{AFTER_HELP_MSG, BEFORE_HELP_MSG};
|
||||
use crate::{
|
||||
commands::args::CopyArgs,
|
||||
input::{AFTER_HELP_MSG, BEFORE_HELP_MSG},
|
||||
};
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(
|
||||
@@ -86,6 +89,8 @@ pub enum Command {
|
||||
/// Toggle column headers on/off in list mode
|
||||
#[command(name = "headers", display_name = ".headers")]
|
||||
Headers(HeadersArgs),
|
||||
#[command(name = "copy", display_name = ".copy")]
|
||||
Copy(CopyArgs),
|
||||
}
|
||||
|
||||
const _HELP_TEMPLATE: &str = "{before-help}{name}
|
||||
|
||||
Reference in New Issue
Block a user