imperative
imperative copied to clipboard
enhancement request: profile to support YAML multiline strings
Hi,
We would like to use YAML multiline strings in profile, such as:
ExecuteScript: |-
line1
line2
...
Currently it's impossible, whenever you provide a value like this in your createProfileFromArgumentsHandler
:
value = `line1
line2`;
You will have it saved as property: "line1\nline2"
, quotes will also be enforced if you try to provide |-
explicitly.
I looked through the libs, and found the root case, if you check the node_modules\@zowe\imperative\lib\profiles\src\utils\ProfileIO.js
- you will find it uses the yamljs
for writing, however it doesn't support multiline strings at the moment (https://github.com/jeremyfa/yaml.js/issues/123).
I also checked if the js-yaml
lib can support that behavior, and it can (https://codesandbox.io/s/gallant-carson-nn87zd?file=/src/index.ts).
import * as yaml from "js-yaml";
const dumped = yaml.dump({
property: "value",
property2: `line1
line2`
});
console.log(dumped);
const loaded = yaml.load(dumped);
console.log(loaded);
Output:
property: value
property2: |-
line1
line2
{property: "value", property2: "line1
line2"}
->
property: "value"
property2: "line1
line2"
Could you please consider switching to the js-yaml
lib?
Thanks, Sergei.