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

[ls] add support for different output formats #403

Merged
merged 2 commits into from Jun 18, 2020
Merged

[ls] add support for different output formats #403

merged 2 commits into from Jun 18, 2020

Conversation

vincetiu8
Copy link
Collaborator

This PR adds support for different output formats for the ls command using the -f or -format flag. Current accepted formats are:

  • default: outputs the normal ls result. If an invalid specifier for the flag is received or the flag is not specified, default will be used.
  • plain / plaintext: outputs only the status of the bug and the title.
  • json: outputs each bug as a JSON object.

Works towards #392 and gets the groundwork in for other flags/output formats in the future. Markdown and org-mode to come!

This adds an optional flag to the ls command that allows users to specify the format they wish to dump the output as. Currently, supported parameters are 'default', 'plain' and 'json'.
commands/ls.go Outdated
}

jsonObject, _ := json.MarshalIndent(jsonBug, "", " ")
fmt.Printf("%s\n", jsonObject)
Copy link
Owner

Choose a reason for hiding this comment

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

printing bugs one by one means the output is not a well formed JSON document. It should be an array.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This should be resolved now, oops.

This prints all the bugs in a JSON array instead of one by one.
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