Repository navigation
Enable displaying tasks as JSON - #165
Conversation
c949995 to
874bdfd
Compare
|
Interesting wrinkle: the error case for the JSON display function wasn't covered in testing, which caused test coverage overall to drop and held up the PR. I dug into the JSON docs in golang to find a value that would trigger the error case so I could account for that in testing, and found that none of the types in the Task struct can accept un-marshalable values. (I tried typecasting and that just resulted in weird, but valid, values.) So I removed the error handling code and left a comment in its place 🙃 Here's the code coverage report that helped me understand that was what was causing code coverage to drop: https://coveralls.io/builds/77696075/source?filename=models%2Fmodels.go#L63 |
|
Hi @joerdav Just checking in when you have a moment. Would appreciate any initial feedback when convenient. All best. |
joerdav
left a comment
There was a problem hiding this comment.
Approved pending 2 changes. Apologies for the delayed response.
Uses encoding/json package to write a task to the target writer as JSON. Co-authored-by: jgart <jgart@dismail.de>
Co-authored-by: jgart <jgart@dismail.de>
874bdfd to
35d06ef
Compare
|
@joerdav I resolved both concerns, ready for re-review. |
35d06ef to
6a816d9
Compare
Fixes #149
Context
In my Emacs integration for xc, I would like to prompt the user for task inputs when they're required, but it's not as straightforward to enumerate the task inputs as I'd like. This PR adds a facility to display the JSON representation for the parsed task data structure, which is ideal for tool integrations like this.
In this PR
Task.DisplayJSONinmodelspackage-output, defaulting to "markdown" but also accepting "json", for the user to control how to display a task (with-display)Next steps
Now that this is ready for review, I'll start work to use this data in the Emacs integration to enumerate task inputs and prompt for them interactively.
Special thanks
Appreciation to @jgarte for pair programming with me on this enhancement. Thank you Jorge!