Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9b5fcdc

Browse files
authored
fix(cli): Where's the command help?fixes#1929 (#1945)
1 parent8840282 commit9b5fcdc

File tree

6 files changed

+108
-310
lines changed

6 files changed

+108
-310
lines changed

‎.editorconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ insert_final_newline = true
99
trim_trailing_whitespace =true
1010

1111
[*.{css,js}]
12-
indent_size =2
12+
indent_size =4
1313

1414
[*.md]
1515
trim_trailing_whitespace =false

‎packages/browser-sync/lib/bin.ts‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,18 @@ if (!module.parent) {
3737
runFromCli();
3838
}
3939

40+
functionfreshYargs(){
41+
returnrequire("yargs")(process.argv.slice(2));
42+
}
43+
4044
functionrunFromCli(){
41-
constyargs=require("yargs")
45+
constyargs=freshYargs()
4246
.command("start","Start the server")
4347
.command("init","Create a configuration file")
4448
.command("reload","Send a reload event over HTTP protocol")
4549
.command("recipe","Generate the files for a recipe")
4650
.version(pkg.version)
51+
.help(false)
4752
.epilogue(
4853
[
4954
"For help running a certain command, type <command> --help",
@@ -69,15 +74,15 @@ function runFromCli() {
6974
constvalid=["start","init","reload","recipe"];
7075

7176
if(valid.indexOf(command)>-1){
72-
returnhandleIncoming(command,yargs.reset());
77+
returnhandleIncoming(command,freshYargs());
7378
}
7479

7580
if(input.length){
76-
returnhandleNoCommand(argv,input,yargs);
81+
returnhandleNoCommand(argv,input,freshYargs());
7782
}
7883

7984
if(existsSync("index.html")){
80-
returnhandleNoCommand(argv,["."],yargs);
85+
returnhandleNoCommand(argv,["."],freshYargs());
8186
}
8287

8388
yargs.showHelp();
@@ -179,7 +184,7 @@ function processStart(yargs) {
179184
.example("$0 start -s app","- Use the App directory to serve files")
180185
.example("$0 start -p www.bbc.co.uk","- Proxy an existing website")
181186
.default("cwd",()=>process.cwd())
182-
.help().argv;
187+
.argv;
183188
}
184189

185190
/**
@@ -206,7 +211,7 @@ function handleIncoming(command, yargs) {
206211
.example("$0 reload")
207212
.example("$0 reload --port 4000")
208213
.default("cwd",()=>process.cwd())
209-
.help().argv;
214+
.argv;
210215
}
211216
if(command==="recipe"){
212217
out=yargs
@@ -215,7 +220,7 @@ function handleIncoming(command, yargs) {
215220
.example("$0 recipe ls","list the recipes")
216221
.example("$0 recipe gulp.sass","use the gulp.sass recipe")
217222
.default("cwd",()=>process.cwd())
218-
.help().argv;
223+
.argv;
219224
}
220225

221226
if(out.help){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp