jsonpp-rs icon indicating copy to clipboard operation
jsonpp-rs copied to clipboard

Feature request: adds an end break line (-w)

Open silvioprog opened this issue 5 years ago • 2 comments

Hi.

Consider the following test:

[user@host ~]$ curl -s http://localhost:8080/fiscalidade/v1/version | jsonpp
{
  "status": "ok",
  "result": {
    "major": 0,
    "minor": 6,
    "patch": 2
  }
}[user@host ~]$

Notice the output JSON doesn't contains an end empty line. With this new feature, it would allow to print as:

[user@host ~]$ curl -s http://localhost:8080/fiscalidade/v1/version | jsonpp <some-option-here>
{
  "status": "ok",
  "result": {
    "major": 0,
    "minor": 6,
    "patch": 2
  }
}
[user@host ~]$

The cURL tool contains a -w feature that is possible to do something like this:

[user@host ~]$ curl -s -w '\n' http://localhost:8080/fiscalidade/v1/version
{"status":"ok","result":{"major":0,"minor":6,"patch":2}}
[user@host ~]$ 

so, a good option to jsonpp tool could be:

[user@host ~]$ curl -s http://localhost:8080/fiscalidade/v1/version | jsonpp -w '\n'
{
  "status": "ok",
  "result": {
    "major": 0,
    "minor": 6,
    "patch": 2
  }
}
[user@host ~]$

WDYT?

silvioprog avatar Feb 24 '20 15:02 silvioprog

thank you for your feature request!

sounds sensible to me. I'd be very willing to accept a pull request implementing this feature. Do you want to implement it? I will help you if you want :)

flo-l avatar Feb 26 '20 08:02 flo-l

Awesome! :-) I'm going to send a PR implementing the feature ...

silvioprog avatar Feb 26 '20 11:02 silvioprog