@clerc/plugin-help 0.12.1 → 0.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +29 -32
- package/dist/index.mjs +29 -32
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -166,40 +166,37 @@ const helpPlugin = ({
|
|
|
166
166
|
examples
|
|
167
167
|
} = {}) => definePlugin({
|
|
168
168
|
setup: (cli) => {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
showSubcommandHelp(ctx2, ctx2.parameters.command);
|
|
190
|
-
} else {
|
|
191
|
-
showHelp(ctx2, notes, examples);
|
|
192
|
-
}
|
|
193
|
-
});
|
|
169
|
+
if (command) {
|
|
170
|
+
cli = cli.command("help", "Show help", {
|
|
171
|
+
parameters: [
|
|
172
|
+
"[command...]"
|
|
173
|
+
],
|
|
174
|
+
notes: [
|
|
175
|
+
"If no command is specified, show help for the CLI.",
|
|
176
|
+
"If a command is specified, show help for the command.",
|
|
177
|
+
"-h is an alias for --help."
|
|
178
|
+
],
|
|
179
|
+
examples: [
|
|
180
|
+
[`$ ${cli._name} help`, "Show help"],
|
|
181
|
+
[`$ ${cli._name} help <command>`, "Show help for a specific command"],
|
|
182
|
+
[`$ ${cli._name} <command> --help`, "Show help for a specific command"]
|
|
183
|
+
]
|
|
184
|
+
}).on("help", (ctx) => {
|
|
185
|
+
if (ctx.parameters.command.length) {
|
|
186
|
+
showSubcommandHelp(ctx, ctx.parameters.command);
|
|
187
|
+
} else {
|
|
188
|
+
showHelp(ctx, notes, examples);
|
|
194
189
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
cli.inspector((ctx, next) => {
|
|
193
|
+
if (ctx.raw.mergedFlags.h || ctx.raw.mergedFlags.help) {
|
|
194
|
+
if (ctx.raw._.length) {
|
|
195
|
+
showSubcommandHelp(ctx, ctx.raw._);
|
|
196
|
+
} else {
|
|
197
|
+
showHelp(ctx, notes, examples);
|
|
202
198
|
}
|
|
199
|
+
} else {
|
|
203
200
|
next();
|
|
204
201
|
}
|
|
205
202
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -166,40 +166,37 @@ const helpPlugin = ({
|
|
|
166
166
|
examples
|
|
167
167
|
} = {}) => definePlugin({
|
|
168
168
|
setup: (cli) => {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
showSubcommandHelp(ctx2, ctx2.parameters.command);
|
|
190
|
-
} else {
|
|
191
|
-
showHelp(ctx2, notes, examples);
|
|
192
|
-
}
|
|
193
|
-
});
|
|
169
|
+
if (command) {
|
|
170
|
+
cli = cli.command("help", "Show help", {
|
|
171
|
+
parameters: [
|
|
172
|
+
"[command...]"
|
|
173
|
+
],
|
|
174
|
+
notes: [
|
|
175
|
+
"If no command is specified, show help for the CLI.",
|
|
176
|
+
"If a command is specified, show help for the command.",
|
|
177
|
+
"-h is an alias for --help."
|
|
178
|
+
],
|
|
179
|
+
examples: [
|
|
180
|
+
[`$ ${cli._name} help`, "Show help"],
|
|
181
|
+
[`$ ${cli._name} help <command>`, "Show help for a specific command"],
|
|
182
|
+
[`$ ${cli._name} <command> --help`, "Show help for a specific command"]
|
|
183
|
+
]
|
|
184
|
+
}).on("help", (ctx) => {
|
|
185
|
+
if (ctx.parameters.command.length) {
|
|
186
|
+
showSubcommandHelp(ctx, ctx.parameters.command);
|
|
187
|
+
} else {
|
|
188
|
+
showHelp(ctx, notes, examples);
|
|
194
189
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
cli.inspector((ctx, next) => {
|
|
193
|
+
if (ctx.raw.mergedFlags.h || ctx.raw.mergedFlags.help) {
|
|
194
|
+
if (ctx.raw._.length) {
|
|
195
|
+
showSubcommandHelp(ctx, ctx.raw._);
|
|
196
|
+
} else {
|
|
197
|
+
showHelp(ctx, notes, examples);
|
|
202
198
|
}
|
|
199
|
+
} else {
|
|
203
200
|
next();
|
|
204
201
|
}
|
|
205
202
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clerc/plugin-help",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.3",
|
|
4
4
|
"author": "Ray <nn_201312@163.com> (https://github.com/so1ve)",
|
|
5
5
|
"description": "Clerc plugin help",
|
|
6
6
|
"keywords": [
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
"@clerc/core": "*"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"
|
|
55
|
-
"@clerc/
|
|
56
|
-
"
|
|
54
|
+
"@clerc/toolkit": "0.12.3",
|
|
55
|
+
"@clerc/utils": "0.12.3",
|
|
56
|
+
"picocolors": "^1.0.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@clerc/core": "0.12.
|
|
59
|
+
"@clerc/core": "0.12.3"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "puild",
|