Skip to content

Commit

Permalink
fix: Make onepasswordRead respect the passed account
Browse files Browse the repository at this point in the history
Indirectly, the lack of setting `onepasswordArgs.account` in
`onepasswordReadTemplateFunc` was causing 1Password to prompt me for an
account, even though it's provided.

The selection is prompted by the `withSessionToken` handling, which
depends on `onepasswordAccount.account`.

Discovered while investigating twpayne#2498.
  • Loading branch information
halostatue authored and twpayne committed Oct 27, 2022
1 parent 800c078 commit 3b95c7e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/cmd/onepasswordtemplatefuncs.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,8 @@ func (c *Config) onepasswordReadTemplateFunc(url string, args ...string) string
case 0:
// Do nothing.
case 1:
onepasswordArgs.args = append(onepasswordArgs.args, "--account", c.onepasswordAccount(args[0]))
onepasswordArgs.account = c.onepasswordAccount(args[0])
onepasswordArgs.args = append(onepasswordArgs.args, "--account", onepasswordArgs.account)
default:
panic(fmt.Errorf("expected 1 or 2 arguments, got %d", len(args)))
}
Expand Down

0 comments on commit 3b95c7e

Please sign in to comment.