Skip to content

Commit

Permalink
feat: added support arguments description (#2659)
Browse files Browse the repository at this point in the history
  • Loading branch information
cap-Bernardito authored Apr 24, 2021
1 parent 8fc8d0e commit 4dfd166
Show file tree
Hide file tree
Showing 6 changed files with 298 additions and 1 deletion.
9 changes: 9 additions & 0 deletions packages/generators/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class GeneratorsCommand {
name: 'init [generation-path]',
alias: ['create', 'new', 'c', 'n'],
description: 'Initialize a new webpack project.',
argsDescription: {
'generation-path': 'Path to the installation directory, e.g. ./projectName',
},
usage: '[generation-path] [options]',
pkg: '@webpack-cli/generators',
},
Expand Down Expand Up @@ -54,6 +57,9 @@ class GeneratorsCommand {
name: 'loader [output-path]',
alias: 'l',
description: 'Scaffold a loader.',
argsDescription: {
'output-path': 'Path to the output directory, e.g. ./loaderName',
},
usage: '[output-path] [options]',
pkg: '@webpack-cli/generators',
},
Expand Down Expand Up @@ -82,6 +88,9 @@ class GeneratorsCommand {
name: 'plugin [output-path]',
alias: 'p',
description: 'Scaffold a plugin.',
argsDescription: {
'output-path': 'Path to the output directory, e.g. ./pluginName',
},
usage: '[output-path] [options]',
pkg: '@webpack-cli/generators',
},
Expand Down
2 changes: 1 addition & 1 deletion packages/webpack-cli/lib/webpack-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class WebpackCLI {
});

if (commandOptions.description) {
command.description(commandOptions.description);
command.description(commandOptions.description, commandOptions.argsDescription);
}

if (commandOptions.usage) {
Expand Down
72 changes: 72 additions & 0 deletions test/help/__snapshots__/help.test.js.snap.devServer3.webpack4
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,9 @@ exports[`help should show help information for 'c' command using command syntax:

Initialize a new webpack project.

Arguments:
generation-path Path to the installation directory, e.g. ./projectName

Options:
--template <value> Type of template (default: \\"default\\")
--force Generate without questions (ideally) using default answers
Expand All @@ -554,6 +557,9 @@ exports[`help should show help information for 'c' command using the "--help" op

Initialize a new webpack project.

Arguments:
generation-path Path to the installation directory, e.g. ./projectName

Options:
--template <value> Type of template (default: \\"default\\")
--force Generate without questions (ideally) using default answers
Expand Down Expand Up @@ -660,6 +666,9 @@ exports[`help should show help information for 'create' command using command sy

Initialize a new webpack project.

Arguments:
generation-path Path to the installation directory, e.g. ./projectName

Options:
--template <value> Type of template (default: \\"default\\")
--force Generate without questions (ideally) using default answers
Expand All @@ -684,6 +693,9 @@ exports[`help should show help information for 'create' command using the "--hel

Initialize a new webpack project.

Arguments:
generation-path Path to the installation directory, e.g. ./projectName

Options:
--template <value> Type of template (default: \\"default\\")
--force Generate without questions (ideally) using default answers
Expand Down Expand Up @@ -850,6 +862,9 @@ exports[`help should show help information for 'init' and respect the "--color"

Initialize a new webpack project.

Arguments:
generation-path Path to the installation directory, e.g. ./projectName

Options:
--template <value> Type of template (default: \\"default\\")
--force Generate without questions (ideally) using default
Expand All @@ -876,6 +891,9 @@ exports[`help should show help information for 'init' and respect the "--no-colo

Initialize a new webpack project.

Arguments:
generation-path Path to the installation directory, e.g. ./projectName

Options:
--template <value> Type of template (default: \\"default\\")
--force Generate without questions (ideally) using default
Expand All @@ -902,6 +920,9 @@ exports[`help should show help information for 'init' command using command synt

Initialize a new webpack project.

Arguments:
generation-path Path to the installation directory, e.g. ./projectName

Options:
--template <value> Type of template (default: \\"default\\")
--force Generate without questions (ideally) using default answers
Expand All @@ -926,6 +947,9 @@ exports[`help should show help information for 'init' command using the "--help"

Initialize a new webpack project.

Arguments:
generation-path Path to the installation directory, e.g. ./projectName

Options:
--template <value> Type of template (default: \\"default\\")
--force Generate without questions (ideally) using default answers
Expand All @@ -950,6 +974,9 @@ exports[`help should show help information for 'l' command using command syntax:

Scaffold a loader.

Arguments:
output-path Path to the output directory, e.g. ./loaderName

Options:
--template <value> Type of template (default: \\"default\\")

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

Scaffold a loader.

Arguments:
output-path Path to the output directory, e.g. ./loaderName

Options:
--template <value> Type of template (default: \\"default\\")

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

Scaffold a loader.

Arguments:
output-path Path to the output directory, e.g. ./loaderName

Options:
--template <value> Type of template (default: \\"default\\")

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

Scaffold a loader.

Arguments:
output-path Path to the output directory, e.g. ./loaderName

Options:
--template <value> Type of template (default: \\"default\\")

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

Scaffold a loader.

Arguments:
output-path Path to the output directory, e.g. ./loaderName

Options:
--template <value> Type of template (default: \\"default\\")

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

Scaffold a loader.

Arguments:
output-path Path to the output directory, e.g. ./loaderName

Options:
--template <value> Type of template (default: \\"default\\")

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

Initialize a new webpack project.

Arguments:
generation-path Path to the installation directory, e.g. ./projectName

Options:
--template <value> Type of template (default: \\"default\\")
--force Generate without questions (ideally) using default answers
Expand All @@ -1236,6 +1281,9 @@ exports[`help should show help information for 'n' command using the "--help" op

Initialize a new webpack project.

Arguments:
generation-path Path to the installation directory, e.g. ./projectName

Options:
--template <value> Type of template (default: \\"default\\")
--force Generate without questions (ideally) using default answers
Expand All @@ -1260,6 +1308,9 @@ exports[`help should show help information for 'new' command using command synta

Initialize a new webpack project.

Arguments:
generation-path Path to the installation directory, e.g. ./projectName

Options:
--template <value> Type of template (default: \\"default\\")
--force Generate without questions (ideally) using default answers
Expand All @@ -1284,6 +1335,9 @@ exports[`help should show help information for 'new' command using the "--help"

Initialize a new webpack project.

Arguments:
generation-path Path to the installation directory, e.g. ./projectName

Options:
--template <value> Type of template (default: \\"default\\")
--force Generate without questions (ideally) using default answers
Expand All @@ -1308,6 +1362,9 @@ exports[`help should show help information for 'p' command using command syntax:

Scaffold a plugin.

Arguments:
output-path Path to the output directory, e.g. ./pluginName

Options:
--template <value> Type of template (default: \\"default\\")

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

Scaffold a plugin.

Arguments:
output-path Path to the output directory, e.g. ./pluginName

Options:
--template <value> Type of template (default: \\"default\\")

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

Scaffold a plugin.

Arguments:
output-path Path to the output directory, e.g. ./pluginName

Options:
--template <value> Type of template (default: \\"default\\")

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

Scaffold a plugin.

Arguments:
output-path Path to the output directory, e.g. ./pluginName

Options:
--template <value> Type of template (default: \\"default\\")

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

Scaffold a plugin.

Arguments:
output-path Path to the output directory, e.g. ./pluginName

Options:
--template <value> Type of template (default: \\"default\\")

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

Scaffold a plugin.

Arguments:
output-path Path to the output directory, e.g. ./pluginName

Options:
--template <value> Type of template (default: \\"default\\")

Expand Down
Loading

0 comments on commit 4dfd166

Please sign in to comment.