refactor: command help
This commit is contained in:
parent
1d06f4a272
commit
63583f53c4
|
@ -62,9 +62,6 @@ program
|
|||
cmd.addOption(options[i]);
|
||||
}
|
||||
cmd.action(forwardProcessCode(action));
|
||||
if (help) {
|
||||
cmd.addHelpText('after', `\n${help}`);
|
||||
}
|
||||
}
|
||||
// Parse commandline.
|
||||
program.parse(process.argv);
|
||||
|
|
|
@ -26,7 +26,7 @@ exports.commands = (program, flecks) => {
|
|||
options: [
|
||||
program.createOption('-d, --dev-dependency', 'add to dev dependencies'),
|
||||
],
|
||||
description: 'add a fleck to your application',
|
||||
description: 'Add a fleck to your application.',
|
||||
action: async ({devDependency}, fleck) => {
|
||||
const args = [];
|
||||
if (['bun', 'yarn'].includes(packageManager)) {
|
||||
|
@ -41,7 +41,7 @@ exports.commands = (program, flecks) => {
|
|||
},
|
||||
},
|
||||
clean: {
|
||||
description: 'remove node_modules, lock file, and build artifacts',
|
||||
description: 'Remove node_modules, lock file, and build artifacts.',
|
||||
action: () => {
|
||||
rimraf.sync(join(flecksRoot, 'dist'));
|
||||
rimraf.sync(join(flecksRoot, 'node_modules'));
|
||||
|
@ -75,7 +75,7 @@ exports.commands = (program, flecks) => {
|
|||
program.createOption('-w, --watch', 'watch for changes')
|
||||
.implies({production: false}),
|
||||
],
|
||||
description: 'build a target in your application',
|
||||
description: 'Build a target in your application.',
|
||||
action: async (target, opts) => {
|
||||
const {
|
||||
hot,
|
||||
|
@ -104,7 +104,7 @@ exports.commands = (program, flecks) => {
|
|||
};
|
||||
}
|
||||
commands.lint = {
|
||||
description: 'run linter',
|
||||
description: 'Run ESLint.',
|
||||
args: [],
|
||||
action: async () => {
|
||||
const promises = [];
|
||||
|
|
|
@ -22,7 +22,15 @@ module.exports = (program, flecks) => {
|
|||
const siteDirArgument = program.createArgument('[siteDir]', 'Docusaurus directory');
|
||||
siteDirArgument.defaultValue = 'website';
|
||||
commands.docusaurus = {
|
||||
description: 'create a documentation website for this project',
|
||||
description: [
|
||||
'Create a documentation website for this project.',
|
||||
'',
|
||||
'The `build` and `start` subcommands are sugar on top of the corresponding Docusaurus commands.',
|
||||
'',
|
||||
'The `create` subcommand will create a documentation website starter template for you at `siteDir`',
|
||||
"if `siteDir` doesn't already exist (defaults to `website`). A `docusaurus.config.js`",
|
||||
"starter configuration will also be copied to your `build` directory if it doesn't already exist.",
|
||||
].join('\n'),
|
||||
action: async (subcommand, siteDir) => {
|
||||
const resolvedSiteDir = resolveSiteDir(siteDir);
|
||||
let siteDirExisted = false;
|
||||
|
@ -79,13 +87,6 @@ module.exports = (program, flecks) => {
|
|||
.choices(['build', 'create', 'start']),
|
||||
siteDirArgument,
|
||||
],
|
||||
help: [
|
||||
'The `build` and `start` subcommands are sugar on top of the corresponding Docusaurus commands.',
|
||||
'',
|
||||
'The `create` subcommand will create a documentation website starter template for you at `siteDir`',
|
||||
"if `siteDir` doesn't already exist (defaults to `website`). A `docusaurus.config.js`",
|
||||
"starter configuration will also be copied to your `build` directory if it doesn't already exist.",
|
||||
].join('\n'),
|
||||
};
|
||||
return commands;
|
||||
};
|
||||
|
|
|
@ -23,7 +23,11 @@ module.exports = (program, flecks) => {
|
|||
program.createOption('-w, --watch', 'watch for changes'),
|
||||
program.createOption('-v, --verbose', 'verbose output'),
|
||||
],
|
||||
description: 'run tests',
|
||||
description: [
|
||||
'Run tests.',
|
||||
'',
|
||||
'The options are passed along to the `build` command.',
|
||||
].join('\n'),
|
||||
action: async (opts) => {
|
||||
const {
|
||||
watch,
|
||||
|
|
|
@ -14,7 +14,7 @@ module.exports = (program, flecks) => {
|
|||
options: [
|
||||
program.createOption('-r, --rlwrap', 'use rlwrap around socat'),
|
||||
],
|
||||
description: 'connect to REPL',
|
||||
description: 'Connect to REPL.',
|
||||
action: async (opts) => {
|
||||
const {
|
||||
rlwrap,
|
||||
|
|
|
@ -31,7 +31,7 @@ Options:
|
|||
```
|
||||
Usage: flecks build [options] [target]
|
||||
|
||||
build a target in your application
|
||||
Build a target in your application.
|
||||
|
||||
Arguments:
|
||||
target build target (choices: "fleck")
|
||||
|
@ -48,7 +48,7 @@ Options:
|
|||
```
|
||||
Usage: flecks clean [options]
|
||||
|
||||
remove node_modules, lock file, and build artifacts
|
||||
Remove node_modules, lock file, and build artifacts.
|
||||
|
||||
Options:
|
||||
-h, --help display help for command
|
||||
|
@ -60,7 +60,13 @@ Options:
|
|||
```
|
||||
Usage: flecks docusaurus [options] <subcommand> [siteDir]
|
||||
|
||||
create a documentation website for this project
|
||||
Create a documentation website for this project.
|
||||
|
||||
The `build` and `start` subcommands are sugar on top of the corresponding Docusaurus commands.
|
||||
|
||||
The `create` subcommand will create a documentation website starter template for you at `siteDir`
|
||||
if `siteDir` doesn't already exist (defaults to `website`). A `docusaurus.config.js`
|
||||
starter configuration will also be copied to your `build` directory if it doesn't already exist.
|
||||
|
||||
Arguments:
|
||||
subcommand Docusaurus command to run (choices: "build", "create", "start")
|
||||
|
@ -68,12 +74,6 @@ Arguments:
|
|||
|
||||
Options:
|
||||
-h, --help display help for command
|
||||
|
||||
The `build` and `start` subcommands are sugar on top of the corresponding Docusaurus commands.
|
||||
|
||||
The `create` subcommand will create a documentation website starter template for you at `siteDir`
|
||||
if `siteDir` doesn't already exist (defaults to `website`). A `docusaurus.config.js`
|
||||
starter configuration will also be copied to your `build` directory if it doesn't already exist.
|
||||
```
|
||||
|
||||
### `lint`
|
||||
|
@ -81,7 +81,7 @@ starter configuration will also be copied to your `build` directory if it doesn'
|
|||
```
|
||||
Usage: flecks lint [options]
|
||||
|
||||
run linter
|
||||
Run ESLint.
|
||||
|
||||
Options:
|
||||
-h, --help display help for command
|
||||
|
@ -93,7 +93,7 @@ Options:
|
|||
```
|
||||
Usage: flecks repl [options]
|
||||
|
||||
connect to REPL
|
||||
Connect to REPL.
|
||||
|
||||
Options:
|
||||
-r, --rlwrap use rlwrap around socat
|
||||
|
@ -105,16 +105,16 @@ Options:
|
|||
```
|
||||
Usage: flecks test [options]
|
||||
|
||||
run tests
|
||||
Run tests.
|
||||
|
||||
Options:
|
||||
-d, --no-production dev build
|
||||
-w, --watch watch for changes
|
||||
-v, --verbose verbose output
|
||||
-h, --help display help for command
|
||||
```
|
||||
|
||||
The options are passed along to the `build` command.
|
||||
```
|
||||
|
||||
## Your commands
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user