cli / go-gh

A Go module for interacting with gh and the GitHub API from the command line.
https://pkg.go.dev/github.com/cli/go-gh/v2
MIT License
322 stars 45 forks source link

jq: add option to pretty print JSON output #116

Closed mjpieters closed 1 year ago

mjpieters commented 1 year ago

Adds a new function EvaluateFormatted to maintain backward compatibility. Indenting output by 2 spaces matches jq output.

Needed for cli/cli#3994

mjpieters commented 1 year ago

@mislav: thanks for the update there, it shows how green I am around my GoLang ears here.

mislav commented 1 year ago

No worries and you're welcome. Your solution wasn't perfectly fine. My approach ins't necessarily less code but I think it might be easier to read and comprehend.

mjpieters commented 1 year ago

No worries and you're welcome. Your solution wasn't perfectly fine. My approach ins't necessarily less code but I think it might be easier to read and comprehend.

Well, I care a lot about readability, and the whole encoder setup was not giving me the 'this code just fits' feeling yet. I like the approach you took because that is a lot more readable. I've made note, so thanks again!