Skip to content

[ls] add support for different output formats#403

Merged
vincetiu8 merged 2 commits intomasterfrom
ls-dump
Jun 18, 2020
Merged

[ls] add support for different output formats#403
vincetiu8 merged 2 commits intomasterfrom
ls-dump

Conversation

@vincetiu8
Copy link
Copy Markdown
Contributor

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'.
Comment thread commands/ls.go Outdated
}

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

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
Copy Markdown
Contributor 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.

2 participants