Skip to content

Commit 4dfd166

Browse files
feat: added support arguments description (#2659)
1 parent 8fc8d0e commit 4dfd166

File tree

6 files changed

+298
-1
lines changed

6 files changed

+298
-1
lines changed

packages/generators/src/index.ts

+9
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ class GeneratorsCommand {
1414
name: 'init [generation-path]',
1515
alias: ['create', 'new', 'c', 'n'],
1616
description: 'Initialize a new webpack project.',
17+
argsDescription: {
18+
'generation-path': 'Path to the installation directory, e.g. ./projectName',
19+
},
1720
usage: '[generation-path] [options]',
1821
pkg: '@webpack-cli/generators',
1922
},
@@ -54,6 +57,9 @@ class GeneratorsCommand {
5457
name: 'loader [output-path]',
5558
alias: 'l',
5659
description: 'Scaffold a loader.',
60+
argsDescription: {
61+
'output-path': 'Path to the output directory, e.g. ./loaderName',
62+
},
5763
usage: '[output-path] [options]',
5864
pkg: '@webpack-cli/generators',
5965
},
@@ -82,6 +88,9 @@ class GeneratorsCommand {
8288
name: 'plugin [output-path]',
8389
alias: 'p',
8490
description: 'Scaffold a plugin.',
91+
argsDescription: {
92+
'output-path': 'Path to the output directory, e.g. ./pluginName',
93+
},
8594
usage: '[output-path] [options]',
8695
pkg: '@webpack-cli/generators',
8796
},

packages/webpack-cli/lib/webpack-cli.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class WebpackCLI {
3838
});
3939

4040
if (commandOptions.description) {
41-
command.description(commandOptions.description);
41+
command.description(commandOptions.description, commandOptions.argsDescription);
4242
}
4343

4444
if (commandOptions.usage) {

test/help/__snapshots__/help.test.js.snap.devServer3.webpack4

+72
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,9 @@ exports[`help should show help information for 'c' command using command syntax:
530530

531531
Initialize a new webpack project.
532532

533+
Arguments:
534+
generation-path Path to the installation directory, e.g. ./projectName
535+
533536
Options:
534537
--template <value> Type of template (default: \\"default\\")
535538
--force Generate without questions (ideally) using default answers
@@ -554,6 +557,9 @@ exports[`help should show help information for 'c' command using the "--help" op
554557

555558
Initialize a new webpack project.
556559

560+
Arguments:
561+
generation-path Path to the installation directory, e.g. ./projectName
562+
557563
Options:
558564
--template <value> Type of template (default: \\"default\\")
559565
--force Generate without questions (ideally) using default answers
@@ -660,6 +666,9 @@ exports[`help should show help information for 'create' command using command sy
660666

661667
Initialize a new webpack project.
662668

669+
Arguments:
670+
generation-path Path to the installation directory, e.g. ./projectName
671+
663672
Options:
664673
--template <value> Type of template (default: \\"default\\")
665674
--force Generate without questions (ideally) using default answers
@@ -684,6 +693,9 @@ exports[`help should show help information for 'create' command using the "--hel
684693

685694
Initialize a new webpack project.
686695

696+
Arguments:
697+
generation-path Path to the installation directory, e.g. ./projectName
698+
687699
Options:
688700
--template <value> Type of template (default: \\"default\\")
689701
--force Generate without questions (ideally) using default answers
@@ -850,6 +862,9 @@ exports[`help should show help information for 'init' and respect the "--color"
850862

851863
Initialize a new webpack project.
852864

865+
Arguments:
866+
generation-path Path to the installation directory, e.g. ./projectName
867+
853868
Options:
854869
--template <value> Type of template (default: \\"default\\")
855870
--force Generate without questions (ideally) using default
@@ -876,6 +891,9 @@ exports[`help should show help information for 'init' and respect the "--no-colo
876891

877892
Initialize a new webpack project.
878893

894+
Arguments:
895+
generation-path Path to the installation directory, e.g. ./projectName
896+
879897
Options:
880898
--template <value> Type of template (default: \\"default\\")
881899
--force Generate without questions (ideally) using default
@@ -902,6 +920,9 @@ exports[`help should show help information for 'init' command using command synt
902920

903921
Initialize a new webpack project.
904922

923+
Arguments:
924+
generation-path Path to the installation directory, e.g. ./projectName
925+
905926
Options:
906927
--template <value> Type of template (default: \\"default\\")
907928
--force Generate without questions (ideally) using default answers
@@ -926,6 +947,9 @@ exports[`help should show help information for 'init' command using the "--help"
926947

927948
Initialize a new webpack project.
928949

950+
Arguments:
951+
generation-path Path to the installation directory, e.g. ./projectName
952+
929953
Options:
930954
--template <value> Type of template (default: \\"default\\")
931955
--force Generate without questions (ideally) using default answers
@@ -950,6 +974,9 @@ exports[`help should show help information for 'l' command using command syntax:
950974

951975
Scaffold a loader.
952976

977+
Arguments:
978+
output-path Path to the output directory, e.g. ./loaderName
979+
953980
Options:
954981
--template <value> Type of template (default: \\"default\\")
955982

@@ -973,6 +1000,9 @@ exports[`help should show help information for 'l' command using the "--help" op
9731000

9741001
Scaffold a loader.
9751002

1003+
Arguments:
1004+
output-path Path to the output directory, e.g. ./loaderName
1005+
9761006
Options:
9771007
--template <value> Type of template (default: \\"default\\")
9781008

@@ -996,6 +1026,9 @@ exports[`help should show help information for 'loader' and respect the "--color
9961026

9971027
Scaffold a loader.
9981028

1029+
Arguments:
1030+
output-path Path to the output directory, e.g. ./loaderName
1031+
9991032
Options:
10001033
--template <value> Type of template (default: \\"default\\")
10011034

@@ -1020,6 +1053,9 @@ exports[`help should show help information for 'loader' and respect the "--no-co
10201053

10211054
Scaffold a loader.
10221055

1056+
Arguments:
1057+
output-path Path to the output directory, e.g. ./loaderName
1058+
10231059
Options:
10241060
--template <value> Type of template (default: \\"default\\")
10251061

@@ -1044,6 +1080,9 @@ exports[`help should show help information for 'loader' command using command sy
10441080

10451081
Scaffold a loader.
10461082

1083+
Arguments:
1084+
output-path Path to the output directory, e.g. ./loaderName
1085+
10471086
Options:
10481087
--template <value> Type of template (default: \\"default\\")
10491088

@@ -1067,6 +1106,9 @@ exports[`help should show help information for 'loader' command using the "--hel
10671106

10681107
Scaffold a loader.
10691108

1109+
Arguments:
1110+
output-path Path to the output directory, e.g. ./loaderName
1111+
10701112
Options:
10711113
--template <value> Type of template (default: \\"default\\")
10721114

@@ -1212,6 +1254,9 @@ exports[`help should show help information for 'n' command using command syntax:
12121254

12131255
Initialize a new webpack project.
12141256

1257+
Arguments:
1258+
generation-path Path to the installation directory, e.g. ./projectName
1259+
12151260
Options:
12161261
--template <value> Type of template (default: \\"default\\")
12171262
--force Generate without questions (ideally) using default answers
@@ -1236,6 +1281,9 @@ exports[`help should show help information for 'n' command using the "--help" op
12361281

12371282
Initialize a new webpack project.
12381283

1284+
Arguments:
1285+
generation-path Path to the installation directory, e.g. ./projectName
1286+
12391287
Options:
12401288
--template <value> Type of template (default: \\"default\\")
12411289
--force Generate without questions (ideally) using default answers
@@ -1260,6 +1308,9 @@ exports[`help should show help information for 'new' command using command synta
12601308

12611309
Initialize a new webpack project.
12621310

1311+
Arguments:
1312+
generation-path Path to the installation directory, e.g. ./projectName
1313+
12631314
Options:
12641315
--template <value> Type of template (default: \\"default\\")
12651316
--force Generate without questions (ideally) using default answers
@@ -1284,6 +1335,9 @@ exports[`help should show help information for 'new' command using the "--help"
12841335

12851336
Initialize a new webpack project.
12861337

1338+
Arguments:
1339+
generation-path Path to the installation directory, e.g. ./projectName
1340+
12871341
Options:
12881342
--template <value> Type of template (default: \\"default\\")
12891343
--force Generate without questions (ideally) using default answers
@@ -1308,6 +1362,9 @@ exports[`help should show help information for 'p' command using command syntax:
13081362

13091363
Scaffold a plugin.
13101364

1365+
Arguments:
1366+
output-path Path to the output directory, e.g. ./pluginName
1367+
13111368
Options:
13121369
--template <value> Type of template (default: \\"default\\")
13131370

@@ -1331,6 +1388,9 @@ exports[`help should show help information for 'p' command using the "--help" op
13311388

13321389
Scaffold a plugin.
13331390

1391+
Arguments:
1392+
output-path Path to the output directory, e.g. ./pluginName
1393+
13341394
Options:
13351395
--template <value> Type of template (default: \\"default\\")
13361396

@@ -1354,6 +1414,9 @@ exports[`help should show help information for 'plugin' and respect the "--color
13541414

13551415
Scaffold a plugin.
13561416

1417+
Arguments:
1418+
output-path Path to the output directory, e.g. ./pluginName
1419+
13571420
Options:
13581421
--template <value> Type of template (default: \\"default\\")
13591422

@@ -1378,6 +1441,9 @@ exports[`help should show help information for 'plugin' and respect the "--no-co
13781441

13791442
Scaffold a plugin.
13801443

1444+
Arguments:
1445+
output-path Path to the output directory, e.g. ./pluginName
1446+
13811447
Options:
13821448
--template <value> Type of template (default: \\"default\\")
13831449

@@ -1402,6 +1468,9 @@ exports[`help should show help information for 'plugin' command using command sy
14021468

14031469
Scaffold a plugin.
14041470

1471+
Arguments:
1472+
output-path Path to the output directory, e.g. ./pluginName
1473+
14051474
Options:
14061475
--template <value> Type of template (default: \\"default\\")
14071476

@@ -1425,6 +1494,9 @@ exports[`help should show help information for 'plugin' command using the "--hel
14251494

14261495
Scaffold a plugin.
14271496

1497+
Arguments:
1498+
output-path Path to the output directory, e.g. ./pluginName
1499+
14281500
Options:
14291501
--template <value> Type of template (default: \\"default\\")
14301502

0 commit comments

Comments
 (0)