-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
ctlv3: add 'print-value-only' flag to get command #6273
Conversation
@@ -45,7 +45,7 @@ var ( | |||
func init() { | |||
rootCmd.PersistentFlags().StringSliceVar(&globalFlags.Endpoints, "endpoints", []string{"127.0.0.1:2379"}, "gRPC endpoints") | |||
|
|||
rootCmd.PersistentFlags().StringVarP(&globalFlags.OutputFormat, "write-out", "w", "simple", "set the output format (json, proto, simple, table)") | |||
rootCmd.PersistentFlags().StringVarP(&globalFlags.OutputFormat, "write-out", "w", "simple", "set the output format (simple-value, json, proto, simple, table)") |
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 feel we probably should add a new flag to kv operations. simple-value does not make sense for other operations like membership management.
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.
alphabetize list
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.
@xiang90 How about only adding cmd.Flags().BoolVar(&printValueOnly, "print-value-only", false, "Print value only")
to get command?
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.
@xiang90 a separate option for kv options doesn't make sense for other printers though; what would be given for something like -value-only -w protobuf
?
@heyitsanthony @xiang90 PTAL. Thanks. |
@@ -69,6 +69,8 @@ GET gets the key or a range of keys [key, range_end) if `range-end` is given. | |||
|
|||
- rev -- specify the kv revision | |||
|
|||
- print-value-only -- print only value when used with write-out=simple |
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.
probably just value-only
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.
--write-value-only
? so it's consistent with -w
/ --write-out
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.
fine with me.
lgtm. defer to @heyitsanthony |
@@ -49,6 +50,7 @@ func NewGetCommand() *cobra.Command { | |||
cmd.Flags().BoolVar(&getFromKey, "from-key", false, "Get keys that are greater than or equal to the given key") | |||
cmd.Flags().Int64Var(&getRev, "rev", 0, "Specify the kv revision") | |||
cmd.Flags().BoolVar(&getKeysOnly, "keys-only", false, "Get only the keys") | |||
cmd.Flags().BoolVar(&printValueOnly, "print-value-only", false, "Print only value when used with write-out=simple") |
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.
Only write values when using the "simple" output format
?
lgtm after fixing the minor nits |
Fixed. Merging in greens. Thanks! |
Fix #6234.
/cc @xiang90 @heyitsanthony