@clerc/plugin-help 0.6.1 → 0.7.0
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.cjs +7 -4
- package/dist/index.mjs +7 -4
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -53,7 +53,10 @@ const helpPlugin = (_options) => clerc.definePlugin({
|
|
|
53
53
|
cli.inspector((inspectorCtx, next) => {
|
|
54
54
|
if (command && !inspectorCtx.isSingleCommand) {
|
|
55
55
|
cli = cli.command("help", "Show help", {
|
|
56
|
-
examples: getExamples(cli)
|
|
56
|
+
examples: getExamples(cli),
|
|
57
|
+
parameters: [
|
|
58
|
+
"[command...]"
|
|
59
|
+
]
|
|
57
60
|
}).on("help", (ctx2) => {
|
|
58
61
|
showHelp(ctx2, rest);
|
|
59
62
|
});
|
|
@@ -76,7 +79,7 @@ const helpPlugin = (_options) => clerc.definePlugin({
|
|
|
76
79
|
}
|
|
77
80
|
return;
|
|
78
81
|
}
|
|
79
|
-
if (!ctx.resolved && ctx.
|
|
82
|
+
if (!ctx.resolved && ctx.raw._.length === 0 && Object.keys(flags).length === 0) {
|
|
80
83
|
showHelp(ctx, rest);
|
|
81
84
|
return;
|
|
82
85
|
}
|
|
@@ -87,7 +90,7 @@ const helpPlugin = (_options) => clerc.definePlugin({
|
|
|
87
90
|
});
|
|
88
91
|
function showHelp(ctx, { examples, notes }) {
|
|
89
92
|
const { cli } = ctx;
|
|
90
|
-
if (ctx.
|
|
93
|
+
if (ctx.raw._.length > 0) {
|
|
91
94
|
showSubcommandHelp(ctx);
|
|
92
95
|
return;
|
|
93
96
|
}
|
|
@@ -136,7 +139,7 @@ function showCommandNotes(notes) {
|
|
|
136
139
|
}
|
|
137
140
|
function showSubcommandHelp(ctx) {
|
|
138
141
|
const { cli } = ctx;
|
|
139
|
-
const commandName = ctx.
|
|
142
|
+
const commandName = ctx.raw._.map(String);
|
|
140
143
|
const commandToShowHelp = clerc.resolveCommand(cli._commands, commandName);
|
|
141
144
|
if (!commandToShowHelp) {
|
|
142
145
|
throw new clerc.NoSuchCommandError(commandName.join(" "));
|
package/dist/index.mjs
CHANGED
|
@@ -45,7 +45,10 @@ const helpPlugin = (_options) => definePlugin({
|
|
|
45
45
|
cli.inspector((inspectorCtx, next) => {
|
|
46
46
|
if (command && !inspectorCtx.isSingleCommand) {
|
|
47
47
|
cli = cli.command("help", "Show help", {
|
|
48
|
-
examples: getExamples(cli)
|
|
48
|
+
examples: getExamples(cli),
|
|
49
|
+
parameters: [
|
|
50
|
+
"[command...]"
|
|
51
|
+
]
|
|
49
52
|
}).on("help", (ctx2) => {
|
|
50
53
|
showHelp(ctx2, rest);
|
|
51
54
|
});
|
|
@@ -68,7 +71,7 @@ const helpPlugin = (_options) => definePlugin({
|
|
|
68
71
|
}
|
|
69
72
|
return;
|
|
70
73
|
}
|
|
71
|
-
if (!ctx.resolved && ctx.
|
|
74
|
+
if (!ctx.resolved && ctx.raw._.length === 0 && Object.keys(flags).length === 0) {
|
|
72
75
|
showHelp(ctx, rest);
|
|
73
76
|
return;
|
|
74
77
|
}
|
|
@@ -79,7 +82,7 @@ const helpPlugin = (_options) => definePlugin({
|
|
|
79
82
|
});
|
|
80
83
|
function showHelp(ctx, { examples, notes }) {
|
|
81
84
|
const { cli } = ctx;
|
|
82
|
-
if (ctx.
|
|
85
|
+
if (ctx.raw._.length > 0) {
|
|
83
86
|
showSubcommandHelp(ctx);
|
|
84
87
|
return;
|
|
85
88
|
}
|
|
@@ -128,7 +131,7 @@ function showCommandNotes(notes) {
|
|
|
128
131
|
}
|
|
129
132
|
function showSubcommandHelp(ctx) {
|
|
130
133
|
const { cli } = ctx;
|
|
131
|
-
const commandName = ctx.
|
|
134
|
+
const commandName = ctx.raw._.map(String);
|
|
132
135
|
const commandToShowHelp = resolveCommand(cli._commands, commandName);
|
|
133
136
|
if (!commandToShowHelp) {
|
|
134
137
|
throw new NoSuchCommandError(commandName.join(" "));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clerc/plugin-help",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"author": "Ray <nn_201312@163.com> (https://github.com/so1ve)",
|
|
5
5
|
"description": "Clerc plugin help",
|
|
6
6
|
"keywords": [
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"clerc": "*"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@clerc/utils": "0.
|
|
47
|
-
"clerc": "0.
|
|
46
|
+
"@clerc/utils": "0.7.0",
|
|
47
|
+
"clerc": "0.7.0",
|
|
48
48
|
"picocolors": "^1.0.0"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|