lenilsondc / vbspretty

VBScript parser and beautifier as a node module
MIT License
5 stars 2 forks source link

indentChar in command line not accepting spaces #3

Open pravynandas opened 3 years ago

pravynandas commented 3 years ago

Platform: Windows 10 Terminal: bash

When the script invoked from command line, the indentChar is working as expected for a tab "\t". However, when spaces given is various approaches not accepted. Please see 3 expamples below. It is working fine when calling from Javascript though.

$ npx vbspretty ./index-unpretty.vbs --level 0 --indentChar "  " --output ./index-pretty-cls-spaced.vbs
Option 'indentChar' accepts tabs or spaces, got '--output' instead

$ npx vbspretty ./index-unpretty.vbs --level 0 --indentChar "spacespace" --output ./index-pretty-cls-spaced.vbs
Option 'indentChar' accepts tabs or spaces, got 'spacespace' instead

$ npx vbspretty ./index-unpretty.vbs --level 0 --indentChar "\s\s" --output ./index-pretty-cls-spaced.vbs
Option 'indentChar' accepts tabs or spaces, got '\s\s' instead
pravynandas commented 3 years ago

Please refer https://github.com/codecubers/vbsnext-demo/tree/main/vbspretty for tests

lenilsondc commented 3 years ago

This problem is specifically to npx on windows, it simply doesn't send the " " to node, it's a known issue apparently but seems to be abandoned.

PR addressing this issue https://github.com/zkat/npx/pull/181/files

I think the best option is to accept \s as a surrogate to space character for the cli. At least it will provide an option to avoid getting locked out by npx.

What do you think @pravynandas ?