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

ctlv3: add 'print-value-only' flag to get command #6273

Merged
merged 2 commits into from
Aug 29, 2016
Merged

Conversation

gyuho
Copy link
Contributor

@gyuho gyuho commented Aug 26, 2016

@@ -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)")
Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

alphabetize list

Copy link
Contributor Author

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?

Copy link
Contributor

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?

@gyuho
Copy link
Contributor Author

gyuho commented Aug 26, 2016

@heyitsanthony @xiang90 PTAL. Thanks.

@gyuho gyuho changed the title etcdctl: add 'simple-value' to print only value ctlv3: add 'print-value-only' flag to get command Aug 26, 2016
@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

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

probably just value-only

Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

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

fine with me.

@xiang90
Copy link
Contributor

xiang90 commented Aug 29, 2016

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")
Copy link
Contributor

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?

@heyitsanthony
Copy link
Contributor

lgtm after fixing the minor nits

@gyuho
Copy link
Contributor Author

gyuho commented Aug 29, 2016

Fixed. Merging in greens. Thanks!

@gyuho gyuho merged commit 396fac4 into etcd-io:master Aug 29, 2016
@gyuho gyuho deleted the get-cmd branch August 29, 2016 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants