2

I've a complex curl command that I want to analyze but it's all minfied into one line. Is there a formatter that would beautify it?

Gama11
  • 31,714
  • 9
  • 78
  • 100
Muhammad Umer
  • 17,263
  • 19
  • 97
  • 168

2 Answers2

1

shell-format can format bash files. Assuming you put that curl command to be part of a bash script, it should work.

fstanis
  • 5,234
  • 1
  • 23
  • 42
  • for some reason it keeps saying: not found! please install manual https://mvdan.cc/sh/cmd/shfmt – Muhammad Umer May 29 '19 at 20:46
  • Well, did you install the tool? – fstanis May 29 '19 at 21:01
  • yes, and i think it didn't properly set path variables. that's a big jump from installing extension to having to install a separate tool and configure path env vars. So im looking for something else if i dont find an extension then ill try again with this. – Muhammad Umer May 31 '19 at 04:46
  • Most extensions related to formatting rely on external tools, I doubt you'll find one that doesn't. – fstanis May 31 '19 at 12:32
0
curl http://example.com/api/getPosts | node <<< "var o = $(cat); console.log(JSON.stringify(o, null, 4));"

Got it from here: https://stackoverflow.com/a/27238477/2159159

Muhammad Usman
  • 458
  • 3
  • 9