Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve kv CLI to remove data or custom metadata using kv patch #18067

Merged
merged 3 commits into from
Nov 21, 2022

Conversation

hghaf099
Copy link
Contributor

@hghaf099 hghaf099 commented Nov 21, 2022

Addresses #18034

Copy link
Contributor

@ccapurso ccapurso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@@ -147,8 +159,8 @@ func (c *KVPatchCommand) Run(args []string) int {
case len(args) < 1:
c.UI.Error(fmt.Sprintf("Not enough arguments (expected >1, got %d)", len(args)))
return 1
case len(args) == 1:
c.UI.Error("Must supply data")
case len(c.flagRemoveData) == 0 && len(args) == 1:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, great change to this check! I can definitely imagine scenarios where users only want to remove data.

}

for _, key := range c.flagRemoveData {
newData[key] = nil
Copy link
Contributor

@ccapurso ccapurso Nov 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Not sure if we wanted to include the same comment that you had above in the kv metadata patch implementation mentioning why the nil is important. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, it would be good context! Thanks for the comment.

@hghaf099 hghaf099 merged commit 4c2b9ee into main Nov 21, 2022
@hghaf099 hghaf099 deleted the patch-kv-allow-deleting-subkeys branch November 21, 2022 22:11
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.

None yet

2 participants