Skip to content

secrets: add kvs flag for secrets get - #1943

Merged
SSharma-10 merged 3 commits into
mainfrom
secrets/add-kv-flag-for-secret-get
Sep 3, 2026
Merged

secrets: add kvs flag for secrets get#1943
SSharma-10 merged 3 commits into
mainfrom
secrets/add-kv-flag-for-secret-get

Conversation

@bentranter

@bentranter bentranter commented Sep 2, 2026

Copy link
Copy Markdown
Member

Adds a new --kvs flag for the doctl secrets get command which prints the secret values as KEY=VALUE pairs.

For example, running:

$ doctl secrets get --region tor1 --kvs my-secret

will output something like:

KEY=b-value
OTHER_KEY=a-value

These will always print in alphabetical order.

Adds a new `--kvs` flag for the `doctl secrets get` command
which prints the secret values as `KEY=VALUE` pairs.

For example, running:

```sh
$ doctl secrets get --region tor1 --kvs my-secret
```

will output something like:

```
OTHER_KEY=a-value
KEY=b-value
```

These will always print in alphabetical order.
@MaxLivesInTheMatrix

Copy link
Copy Markdown
Contributor

As I was writing my comment about alphabetical order I see you fixed it lol. But yeah this looks good. Idk why I didn't implement this the first time I went through this though...

@bentranter
bentranter marked this pull request as ready for review September 2, 2026 17:55
@SSharma-10

Copy link
Copy Markdown
Contributor

--raw is checked before --kvs, so this fails even though --kvs would ignore --raw:

doctl secrets get anything --region nyc3 --kvs --raw

It returns --raw requires --key

We could either short-circuit --kvs earlier or explicitly reject conflicting flags
Also, it’d be good to mention --kvs in the secrets get long help since it currently only covers --show / --raw.

Otherwise LGTM

@bentranter

Copy link
Copy Markdown
Member Author

Updated, thanks for the feedback @SSharma-10

@SSharma-10

Copy link
Copy Markdown
Contributor

Updated, thanks for the feedback @SSharma-10

LGTM, thank you.

@SSharma-10
SSharma-10 merged commit 5f5c33e into main Sep 3, 2026
9 checks passed
@SSharma-10
SSharma-10 deleted the secrets/add-kv-flag-for-secret-get branch September 3, 2026 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants