Skip to content

Conversation

@justenstall
Copy link

Adds a --json flag to the nats kv ls command to format the output as JSON.

ls.Flag("names", "Show just the bucket names").Short('n').UnNegatableBoolVar(&c.listNames)
ls.Flag("verbose", "Show detailed info about the key").Short('v').UnNegatableBoolVar(&c.lsVerbose)
ls.Flag("display-value", "Display value in verbose output (has no effect without 'verbose')").UnNegatableBoolVar(&c.lsVerboseDisplayValue)
ls.Flag("json", "Produce JSON output").Short('j').UnNegatableBoolVar(&c.json)
Copy link
Collaborator

Choose a reason for hiding this comment

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

not really keen on adding our own json representations here for info and keys the nats.go library doesn't have them, we risk inventing something here thats not compatible with future nats.go

So it would be fine for ls that just shows names - but not for info and the extended versions of ls

So if we can rescope this down to just the short ls output and then suggest you open issue with nats.go to add marshaller interfaces to the kv (and obj) data structures, once those have a standard method we can use them here

Copy link
Author

Choose a reason for hiding this comment

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

That makes sense, I'll open an issue in nats.go

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.

2 participants