shell-plugins icon indicating copy to clipboard operation
shell-plugins copied to clipboard

Easily switch between multiple credentials for a single CLI tool.

Open skyzyx opened this issue 3 years ago • 3 comments

op CLI version

2.12.0

Goal or desired behavior

There are several cases where I manage different credential sets for the same CLI command.

For example, I manage over 180 AWS accounts (I use AWS Vault for this and am not planning on switching, but it makes for a good example.)

I have read-only + admin tokens for both GitHub.com as well as multiple GitHub Enterprise users. If I'm using the gh command, switching between them should be easy.

Current behavior

Unknown. I can't tell if/how this is supported.

Relevant log output

N/A

skyzyx avatar Dec 25 '22 04:12 skyzyx

Just wanted to share my interest for this ability as well. Right now, the only way to switch to another credential is to first run op plugin clear plugin-name followed by any command for that plugin, thus being prompted to choose the credential again.

I ran into the need for this ability when building the Fastly shell plugin:

  • https://github.com/1Password/shell-plugins/pull/169

A variant of the [needsauth.Always()](https://github.com/1Password/shell-plugins/blob/d4822d5ebb3ddf2d633316e1a2f06852bebccaf5/sdk/needsauth/helpers.go#L55-L59) helper function would be nice. For example, in the Fastly CLI case, any command starting with fastly profile could prompt the user to choose the credential before executing the rest of the command. Example code:

NeedsAuth: needsauth.IfAll(
			needsauth.Always(
				needsauth.ForCommand("profile"),
			),
		),

arunsathiya avatar Jan 31 '23 03:01 arunsathiya

The ability to specify a secret name directly on the cli when executing would be amazing. op plugin run --secret "Account/Vault/secret" -- aws

lugoues avatar Feb 09 '23 04:02 lugoues

I would love to have this for picking a database environment (e.g. local, dev, staging, etc.) when using pgcli. Maybe if the plugin has been init'd with multiple credentials it can prompt to choose one instead of just using the most recently selected credential?

chrislambe avatar Dec 15 '23 18:12 chrislambe