-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat(kv): support setting key/value pairs #171
feat(kv): support setting key/value pairs #171
Conversation
23ed408
to
e4e5195
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - I think this would also benefit from some general refactoring, but that should be done after this is merged.
@@ -74,6 +79,29 @@ impl From<GroupBy> for ResourceGroupBy { | |||
} | |||
} | |||
|
|||
#[derive(Parser, Debug)] | |||
pub struct SetCommand { | |||
/// The name of the key value store |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if Clap is smart enough to show the user that if they don't set this they have to set the app/label. If not, can we document that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made some small adjustments (some conflicts withs), and it detects and tells the user when they have miscombined the flags. For example:
Kates-MacBook-Pro :: ~/Programs/cloud-plugin 2 » cargo run -- kv set --app a
Finished dev [unoptimized + debuginfo] target(s) in 0.16s
Running `target/debug/cloud-plugin kv set --app a`
error: The following required arguments were not provided:
--label <LABEL>
USAGE:
And:
Kates-MacBook-Pro :: ~/Programs/cloud-plugin 2 » cargo run -- kv set --store s --app a
Finished dev [unoptimized + debuginfo] target(s) in 0.42s
Running `target/debug/cloud-plugin kv set --store s --app a`
error: The argument '--store <STORE>' cannot be used with '--app <APP>'
USAGE:
spin cloud key-value set --store <STORE>
For more information try --help
Signed-off-by: Kate Goldenring <[email protected]>
e4e5195
to
4df98f6
Compare
Adds
spin cloud key-value set
command:spin cloud key-value set --store "foo"
spin cloud key-value set --label "foo" --app "myapp"
Comparable to
spin cloud sqlite execute
commandThe cloud API does not yet expose
delete
andlist
pairs endpoints, but once it does, I'll add them