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:
2026-08-13 22:46:57 +02:00
parent 0e15ac061b
commit 125d72c918
5 changed files with 73 additions and 0 deletions

View File

@@ -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>,
}