Since optimist always sets the same default values no matter what on the CLI, when using the JS interface, those values aren't defined yet, so the defaulting code runs and applies the defaults from the templates for all the formats.
To Reproduce
With JS, use { format: 'pixi.js' }, which will set 'trim' to true. This combined with gutter produces messed up results, and what led me to find this bug.
On the CLI, use "-f pixi.js", which sets 'trim' to false. This works fine with gutter.
Possible solution
Remove the default values from the command line parser, so that the regular logic in the generate() function runs and properly populates these values.
Problem
Since optimist always sets the same default values no matter what on the CLI, when using the JS interface, those values aren't defined yet, so the defaulting code runs and applies the defaults from the templates for all the formats.
To Reproduce
With JS, use { format: 'pixi.js' }, which will set 'trim' to true. This combined with gutter produces messed up results, and what led me to find this bug. On the CLI, use "-f pixi.js", which sets 'trim' to false. This works fine with gutter.
Possible solution
Remove the default values from the command line parser, so that the regular logic in the generate() function runs and properly populates these values.