Skip to content

Commit 8d7ec64

Browse files
committed
Auto merge of #12985 - Turbo87:fix-1password-account-usage, r=ehuss
cargo-credential-1password: Add missing `--account` argument to `op signin` command ### What does this PR try to resolve? Without this the account chooser is shown by the `op signin` command, even though the user has already specified an account via the `--account` command line argument to the `cargo-credential-1password` CLI. Note that the `--vault` in this case does not need to be forwarded to `op`, since it is irrelevant for the `op signin` command. ### How should we test and review this PR? - Have a 1password installation with multiple accounts - Use `global-credential-providers = ["cargo-credential-1password --account my.1password.com"]` in the cargo config file - Run e.g. `cargo publish` - Notice how you are seeing an account switcher even though `--account` was used - Apply this patch and notice that the account switcher is no longer there and the correct account is selected automatically ### Additional information see https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/1password.20credentials.20provider
2 parents 9f3b488 + a91cae4 commit 8d7ec64

File tree

1 file changed

+4
-0
lines changed
  • credential/cargo-credential-1password/src

1 file changed

+4
-0
lines changed

credential/cargo-credential-1password/src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ impl OnePasswordKeychain {
8282
}
8383
let mut cmd = Command::new("op");
8484
cmd.args(["signin", "--raw"]);
85+
if let Some(account) = &self.account {
86+
cmd.arg("--account");
87+
cmd.arg(account);
88+
}
8589
cmd.stdout(Stdio::piped());
8690
let mut child = cmd
8791
.spawn()

0 commit comments

Comments
 (0)