feat(cli): clap surface for import lastpass

Adds the Import command group with a Lastpass subcommand.
Stub returns `not implemented` so the help text is reachable
ahead of the body landing in Task 8.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
adlee-was-taken
2026-04-29 23:12:44 -04:00
parent 6f2e868892
commit ab8839a46a

View File

@@ -100,6 +100,12 @@ enum Commands {
action: BackupAction, action: BackupAction,
}, },
/// Import items from another password manager into the unlocked vault.
Import {
#[command(subcommand)]
action: ImportAction,
},
/// Attach a file to an item. /// Attach a file to an item.
Attach { query: String, file: PathBuf }, Attach { query: String, file: PathBuf },
@@ -309,6 +315,18 @@ enum BackupAction {
}, },
} }
#[derive(Subcommand)]
enum ImportAction {
/// Import a LastPass CSV export into the unlocked vault.
/// Each row creates a new item with a freshly-minted ID; title
/// collisions are kept (no dedup). Failed rows are skipped and
/// reported on stderr.
Lastpass {
/// Path to the LastPass-format CSV export.
csv: PathBuf,
},
}
fn main() -> Result<()> { fn main() -> Result<()> {
let cli = Cli::parse(); let cli = Cli::parse();
match cli.command { match cli.command {
@@ -323,6 +341,7 @@ fn main() -> Result<()> {
Commands::Purge { query } => cmd_purge(query), Commands::Purge { query } => cmd_purge(query),
Commands::Trash { action } => cmd_trash(action), Commands::Trash { action } => cmd_trash(action),
Commands::Backup { action } => cmd_backup(action), Commands::Backup { action } => cmd_backup(action),
Commands::Import { action } => cmd_import(action),
Commands::Attach { query, file } => cmd_attach(query, file), Commands::Attach { query, file } => cmd_attach(query, file),
Commands::Attachments { query } => cmd_attachments(query), Commands::Attachments { query } => cmd_attachments(query),
Commands::Extract { query, aid, out } => cmd_extract(query, aid, out), Commands::Extract { query, aid, out } => cmd_extract(query, aid, out),
@@ -1539,6 +1558,16 @@ fn cmd_backup_restore(input: PathBuf, target: PathBuf) -> Result<()> {
Ok(()) Ok(())
} }
fn cmd_import(action: ImportAction) -> Result<()> {
match action {
ImportAction::Lastpass { csv } => cmd_import_lastpass(csv),
}
}
fn cmd_import_lastpass(_csv: PathBuf) -> Result<()> {
bail!("not implemented yet — Task 8 lands the body")
}
fn cmd_trash_empty() -> Result<()> { fn cmd_trash_empty() -> Result<()> {
use relicario_core::time::now_unix; use relicario_core::time::now_unix;