Skip to content
Myr

fix(examples): use dash separator to avoid MINGW64 path expansion (#2475)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Changed example separator from '/' to '-' in split.js, string-util.js, and both English and Chinese READMEs. This avoids path expansion issues on MINGW64/Git Bash where '/a/b/c' gets converted to Windows paths.

authored by Seokrin Taron Sung · committed by GitHub · parent 17bf62c · Browse files · 4 files+9 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+9 added−9 removed

  • other:+9 added−9 removed

4 files+9 added−9 removed

modified:examples/split.js+2 added-2 removed
modified:examples/string-util.js+1 added-1 removed
modified:Readme_zh-CN.md+3 added-3 removed
86 unmodified lines
87console.log(program.args[0].split(options.separator, limit));88```8990```console91$ node split.js -s / --fits a/b/c91$ node split.js -s - --fits a-b-c92error: unknown option '--fits'93(Did you mean --first?)94$ node split.js -s / --first a/b/c94$ node split.js -s - --first a-b-c95[ 'a' ]96```9798这是一个使用子命令并带有帮助描述的更完整的程序。在多命令程序中,每个命令(或命令的独立可执行文件)都有一个操作处理程序。
35 unmodified lines
134 --first display just the first substring135 -s, --separator <char> separator character (default: ",")136 -h, --help display help for command137138$ node string-util.js split --separator=/ a/b/c138$ node string-util.js split --separator=- a-b-c139[ 'a', 'b', 'c' ]140```141142更多示例可以在 [examples](https://github.com/tj/commander.js/tree/master/examples) 目录中找到。
930 unmodified lines
modified:Readme.md+3 added-3 removed
89 unmodified lines
90console.log(program.args[0].split(options.separator, limit));91```9293```console94$ node split.js -s / --fits a/b/c94$ node split.js -s - --fits a-b-c95error: unknown option '--fits'96(Did you mean --first?)97$ node split.js -s / --first a/b/c97$ node split.js -s - --first a-b-c98[ 'a' ]99```100101Here is a more complete program using a subcommand and with descriptions for the help. In a multi-command program, you have an action handler for each command (or stand-alone executables for the commands).
35 unmodified lines
137 --first display just the first substring138 -s, --separator <char> separator character (default: ",")139 -h, --help display help for command140141$ node string-util.js split --separator=/ a/b/c141$ node string-util.js split --separator=- a-b-c142[ 'a', 'b', 'c' ]143```144145More samples can be found in the [examples](https://github.com/tj/commander.js/tree/master/examples) directory.
1031 unmodified lines