Skip to content

Commit

Permalink
Auto merge of rust-lang#12985 - Turbo87:fix-1password-account-usage, …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
bors authored and ehuss committed Nov 17, 2023
1 parent 6790a51 commit 3aa3b0c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions credential/cargo-credential-1password/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ impl OnePasswordKeychain {
}
let mut cmd = Command::new("op");
cmd.args(["signin", "--raw"]);
if let Some(account) = &self.account {
cmd.arg("--account");
cmd.arg(account);
}
cmd.stdout(Stdio::piped());
let mut child = cmd
.spawn()
Expand Down

0 comments on commit 3aa3b0c

Please sign in to comment.