Add transfer subcommand for bulk profile export/import
-e/--export writes every saved profile to a single TOML file as a [[profile]] array; -i/--import reads one back and saves each entry, failing on the first name collision rather than silently overwriting. Reuses Profile's existing Serialize/Deserialize impl directly, so the file format is just the same shape already written to ~/.config/porthole/profiles/<name>.toml, aggregated. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
14
src/cli.rs
14
src/cli.rs
@@ -41,6 +41,9 @@ pub enum Commands {
|
||||
#[command(visible_alias = "reset")]
|
||||
Wipe(WipeArgs),
|
||||
|
||||
/// Export saved profiles to a file, or import them from one.
|
||||
Transfer(TransferArgs),
|
||||
|
||||
/// Generate a shell completion script.
|
||||
Completions { shell: Shell },
|
||||
|
||||
@@ -182,3 +185,14 @@ pub struct WipeArgs {
|
||||
#[arg(short, long)]
|
||||
pub yes: bool,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct TransferArgs {
|
||||
/// Export all saved profiles to a file.
|
||||
#[arg(short, long, value_name = "PATH")]
|
||||
pub export: Option<String>,
|
||||
|
||||
/// Import profiles from a file.
|
||||
#[arg(short, long, value_name = "PATH")]
|
||||
pub import: Option<String>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user