3 ms·
This scripting is not a part of YAML. It could be done in JSON as well: {"command": [ "/bin/sh", "-c", "rm -rf $HOME" ]} In fact, this is comp
by xigoi 8mo ago
This scripting is not a part of YAML. It could be done in JSON as well:
{"command": [
"/bin/sh",
"-c",
"rm -rf $HOME"
]}
In fact, this is completely equivalent to your YAML.
- pseudohadamard 8mo agoThe difference is that in YAML it's kind of expected (the second pseudocode example is from Home Assistant where almost everything nontrivial requires embedding scripting inside your YAML) while I've never seen it done in JSON.
- xigoi 8mo agoJupyter notebooks are a form of scripting in JSON. Anyway, all this is the fault of specific tools, not of YAML. This is like saying that laundry pods are bad because people eat them.
- drysart 8mo agoThe use cases for YAML that don't involve any sort of scripting vastly outnumber the use cases for YAML that involve embedding scripts into a document; so it's a little unfair and inaccurate to say that "in YAML it's kind of expected". It is more fair to say that if your document needs to contain scripting, YAML is a better choice than JSON; for the singular reason that YAML allows for unquoted multiline strings, which means you can easily copy/paste scripts in and out of a YAML document without needing to worry about escaping and unescaping quotes and newline characters when editing the document.