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

add support for json/yaml output to list #35

Merged
merged 3 commits into from
Jan 31, 2023
Merged

Conversation

k15r
Copy link
Contributor

@k15r k15r commented Jan 27, 2023

This PR adds support to print the output of list in json format.
The format is quite handy it you want to process further e.g. during generation of documentation.

use -oyaml / --ojson --output= ...

@k15r k15r marked this pull request as ready for review January 27, 2023 11:06
Copy link
Owner

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! Just a small question about the flag!

@@ -58,6 +60,7 @@ func main() {
Default("false").Short('s').Bool()
listPrintAddPos := listCmd.Flag("add-position", "Add metric position column when printing the result.").Default("false").Bool()
listPrintAddHelp := listCmd.Flag("add-help", "Add metric help column when printing the result.").Default("false").Bool()
listPrintJSON := listCmd.Flag("json", "Print result as json.").Default("false").Bool()
Copy link
Owner

Choose a reason for hiding this comment

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

Instead of a bool for printing out using json format, what do you think about having an output flag as a string to be extensible to support different formats like json, markdown, etc

@k15r
Copy link
Contributor Author

k15r commented Jan 28, 2023

Sounds like a good idea. Let me check if i can add support for the other usual suspect (yaml).

@k15r k15r changed the title add support for json output to list add support for json/yaml output to list Jan 30, 2023
@k15r k15r requested a review from yeya24 January 31, 2023 15:12
Copy link
Owner

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

Thanks!

@yeya24 yeya24 merged commit 2a6d0d4 into yeya24:master Jan 31, 2023
@coanor coanor mentioned this pull request May 15, 2023
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