Skip to content

Commit 7f67658

Browse files
committed
Provide an import command
1 parent 7bb160b commit 7f67658

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

bpb/src/main.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ fn main() -> Result<(), Error> {
3030
bail!("Must specify a userid argument, e.g.: `bpb init \"username <email>\"`")
3131
}
3232
}
33+
Some("import") => import(),
3334
Some("upgrade") => upgrade(),
3435
Some("print") => print_public_key(),
3536
Some("--help") => print_help_message(),
@@ -145,6 +146,15 @@ fn upgrade() -> Result<(), Error> {
145146
config.write()
146147
}
147148

149+
fn import() -> Result<(), Error> {
150+
let config = Config::load()?;
151+
let service = config.service();
152+
let account = config.user_id();
153+
154+
let key = std::env::args().nth(2).unwrap();
155+
add_keychain_item(service, account, &key)
156+
}
157+
148158
fn legacy_keys_file() -> String {
149159
std::env::var("BPB_KEYS")
150160
.unwrap_or_else(|_| format!("{}/.bpb_keys.toml", std::env::var("HOME").unwrap()))

0 commit comments

Comments
 (0)