@shell-shock/preset-cli 0.8.19 → 0.9.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/README.md +1 -1
- package/dist/components/banner-builtin.cjs +14 -8
- package/dist/components/banner-builtin.d.cts +1 -1
- package/dist/components/banner-builtin.d.cts.map +1 -1
- package/dist/components/banner-builtin.d.mts +2 -2
- package/dist/components/banner-builtin.d.mts.map +1 -1
- package/dist/components/banner-builtin.mjs +11 -5
- package/dist/components/banner-builtin.mjs.map +1 -1
- package/dist/components/command-entry.cjs +6 -6
- package/dist/components/command-entry.d.mts +1 -1
- package/dist/components/command-entry.mjs +5 -5
- package/dist/components/command-router.cjs +1 -1
- package/dist/components/command-router.mjs +1 -1
- package/dist/components/upgrade-builtin.cjs +1 -1
- package/dist/components/upgrade-builtin.mjs +1 -1
- package/dist/components/virtual-command-entry.cjs +2 -2
- package/dist/components/virtual-command-entry.d.mts +1 -1
- package/dist/components/virtual-command-entry.mjs +1 -1
- package/dist/index.cjs +8 -7
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +7 -8
- package/dist/index.mjs.map +1 -1
- package/dist/types/plugin.d.cts +16 -7
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +16 -7
- package/dist/types/plugin.d.mts.map +1 -1
- package/package.json +11 -8
- package/dist/plugin-banner/dist/components/banner-builtin.cjs +0 -63
- package/dist/plugin-banner/dist/components/banner-builtin.mjs +0 -62
- package/dist/plugin-banner/dist/components/banner-builtin.mjs.map +0 -1
- package/dist/plugin-banner/dist/components/banner-function-declaration.cjs +0 -138
- package/dist/plugin-banner/dist/components/banner-function-declaration.d.cts +0 -45
- package/dist/plugin-banner/dist/components/banner-function-declaration.d.cts.map +0 -1
- package/dist/plugin-banner/dist/components/banner-function-declaration.d.mts +0 -45
- package/dist/plugin-banner/dist/components/banner-function-declaration.d.mts.map +0 -1
- package/dist/plugin-banner/dist/components/banner-function-declaration.mjs +0 -136
- package/dist/plugin-banner/dist/components/banner-function-declaration.mjs.map +0 -1
- package/dist/plugin-banner/dist/components/index.cjs +0 -2
- package/dist/plugin-banner/dist/components/index.mjs +0 -4
- package/dist/plugin-banner/dist/index.cjs +0 -70
- package/dist/plugin-banner/dist/index.d.cts +0 -2
- package/dist/plugin-banner/dist/index.d.mts +0 -2
- package/dist/plugin-banner/dist/index.mjs +0 -68
- package/dist/plugin-banner/dist/index.mjs.map +0 -1
- package/dist/plugin-banner/dist/types/plugin.d.cts +0 -31
- package/dist/plugin-banner/dist/types/plugin.d.cts.map +0 -1
- package/dist/plugin-banner/dist/types/plugin.d.mts +0 -31
- package/dist/plugin-banner/dist/types/plugin.d.mts.map +0 -1
- package/dist/plugin-help/dist/components/display.cjs +0 -285
- package/dist/plugin-help/dist/components/display.mjs +0 -280
- package/dist/plugin-help/dist/components/display.mjs.map +0 -1
- package/dist/plugin-help/dist/components/help-builtin.cjs +0 -85
- package/dist/plugin-help/dist/components/help-builtin.mjs +0 -84
- package/dist/plugin-help/dist/components/help-builtin.mjs.map +0 -1
- package/dist/plugin-help/dist/components/help-command.cjs +0 -96
- package/dist/plugin-help/dist/components/help-command.mjs +0 -96
- package/dist/plugin-help/dist/components/help-command.mjs.map +0 -1
- package/dist/plugin-help/dist/components/index.cjs +0 -3
- package/dist/plugin-help/dist/components/index.mjs +0 -5
- package/dist/plugin-help/dist/index.cjs +0 -106
- package/dist/plugin-help/dist/index.d.cts +0 -2
- package/dist/plugin-help/dist/index.d.mts +0 -2
- package/dist/plugin-help/dist/index.mjs +0 -103
- package/dist/plugin-help/dist/index.mjs.map +0 -1
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_types@0.11.2/node_modules/@stryke/types/dist/base.d.cts +0 -19
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_types@0.11.2/node_modules/@stryke/types/dist/base.d.cts.map +0 -1
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_types@0.11.2/node_modules/@stryke/types/dist/base.d.mts +0 -19
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_types@0.11.2/node_modules/@stryke/types/dist/base.d.mts.map +0 -1
- package/dist/plugin-help/dist/types/plugin.d.cts +0 -63
- package/dist/plugin-help/dist/types/plugin.d.cts.map +0 -1
- package/dist/plugin-help/dist/types/plugin.d.mts +0 -63
- package/dist/plugin-help/dist/types/plugin.d.mts.map +0 -1
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import { For, Show, code, computed } from "@alloy-js/core";
|
|
3
|
-
import { formatDescription, formatShortDescription, getAppBin, getAppTitle, getDynamicPathSegmentName, isDynamicPathSegment, sortOptions } from "@shell-shock/core/plugin-utils";
|
|
4
|
-
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
5
|
-
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
6
|
-
import { useTheme } from "@shell-shock/plugin-theme/contexts/theme";
|
|
7
|
-
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
8
|
-
import { CommandParameterKinds } from "@shell-shock/core";
|
|
9
|
-
import { camelCase } from "@stryke/string-format/camel-case";
|
|
10
|
-
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
11
|
-
import { snakeCase } from "@stryke/string-format/snake-case";
|
|
12
|
-
|
|
13
|
-
//#region ../plugin-help/dist/components/display.mjs
|
|
14
|
-
/**
|
|
15
|
-
* A component that generates the usage display for a command.
|
|
16
|
-
*/
|
|
17
|
-
function HelpUsageDisplay(props) {
|
|
18
|
-
const { command, indent = 2 } = props;
|
|
19
|
-
const context = usePowerlines();
|
|
20
|
-
const theme = useTheme();
|
|
21
|
-
return [createComponent(For, {
|
|
22
|
-
get each() {
|
|
23
|
-
return Object.keys(context.config.bin);
|
|
24
|
-
},
|
|
25
|
-
hardline: true,
|
|
26
|
-
children: (bin) => [memo(() => code`
|
|
27
|
-
writeLine(
|
|
28
|
-
colors.text.body.secondary(\`\${colors.border.app.divider.tertiary("\$_")} \${colors.text.usage.bin("${bin}")}${command.segments.length > 0 ? ` ${command.segments.map((segment) => `\${colors.text.usage.${isDynamicPathSegment(segment) ? "dynamic" : "command"}("${isDynamicPathSegment(segment) ? `[${snakeCase(getDynamicPathSegmentName(segment))}]` : segment}")}`).join(" ")}` : ""}${Object.values(command.children).length > 0 ? ` \${colors.text.usage.dynamic("[command]")}` : ""}${command.args.length > 0 ? ` ${command.args.map((arg) => `\${colors.text.usage.args("<${snakeCase((arg.kind === CommandParameterKinds.string || arg.kind === CommandParameterKinds.number) && arg.choices && arg.choices.length > 0 ? arg.choices.join("|") : arg.kind === CommandParameterKinds.string && arg.format ? arg.format : arg.name)}${(arg.kind === CommandParameterKinds.string || arg.kind === CommandParameterKinds.number) && arg.variadic ? "..." : ""}>")}`).join(" ")}` : ""} \${colors.text.usage.options("[options]")}\`), { padding: ${theme.padding.app * indent} }
|
|
29
|
-
);`), createIntrinsic("hbr", {})]
|
|
30
|
-
}), createComponent(Show, {
|
|
31
|
-
get when() {
|
|
32
|
-
return command.args.length > 0;
|
|
33
|
-
},
|
|
34
|
-
get children() {
|
|
35
|
-
return [createIntrinsic("hbr", {}), createComponent(For, {
|
|
36
|
-
get each() {
|
|
37
|
-
return Object.keys(context.config.bin);
|
|
38
|
-
},
|
|
39
|
-
hardline: true,
|
|
40
|
-
children: (bin) => [memo(() => code`
|
|
41
|
-
writeLine(
|
|
42
|
-
colors.text.body.secondary(\`\$ \${colors.text.usage.bin("${bin}")}${command.segments.length > 0 ? ` ${command.segments.map((segment) => `\${colors.text.usage.${isDynamicPathSegment(segment) ? "dynamic" : "command"}("${isDynamicPathSegment(segment) ? `[${snakeCase(getDynamicPathSegmentName(segment))}]` : segment}")}`).join(" ")}` : ""}${Object.values(command.children).length > 0 ? ` \${colors.text.usage.dynamic("[command]")}` : ""} \${colors.text.usage.options("[options]")}${command.args.length > 0 ? ` ${command.args.map((arg) => `\${colors.text.usage.args("<${snakeCase((arg.kind === CommandParameterKinds.string || arg.kind === CommandParameterKinds.number) && arg.choices && arg.choices.length > 0 ? arg.choices.join("|") : arg.kind === CommandParameterKinds.string && arg.format ? arg.format : arg.name)}${(arg.kind === CommandParameterKinds.string || arg.kind === CommandParameterKinds.number) && arg.variadic ? "..." : ""}>")}`).join(" ")}` : ""}\`), { padding: ${theme.padding.app * indent} }
|
|
43
|
-
);`), createIntrinsic("hbr", {})]
|
|
44
|
-
})];
|
|
45
|
-
}
|
|
46
|
-
})];
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* A component that generates the options table display for a command.
|
|
50
|
-
*/
|
|
51
|
-
function HelpOptionsDisplay(props) {
|
|
52
|
-
const { options } = props;
|
|
53
|
-
const context = usePowerlines();
|
|
54
|
-
return [
|
|
55
|
-
code`table([ `,
|
|
56
|
-
createIntrinsic("hbr", {}),
|
|
57
|
-
createComponent(For, {
|
|
58
|
-
get each() {
|
|
59
|
-
return sortOptions(options);
|
|
60
|
-
},
|
|
61
|
-
hardline: true,
|
|
62
|
-
children: (option) => {
|
|
63
|
-
const flags = [];
|
|
64
|
-
const names = [];
|
|
65
|
-
if (option.name.length === 1) flags.push(`-${option.name}`);
|
|
66
|
-
else names.push(`--${kebabCase(option.name)}`);
|
|
67
|
-
option.alias.forEach((alias) => {
|
|
68
|
-
if (alias.length === 1) flags.push(`-${alias}`);
|
|
69
|
-
else names.push(`--${kebabCase(alias)}`);
|
|
70
|
-
});
|
|
71
|
-
return code`[{ value: colors.text.body.primary("${flags.length > 0 ? `${flags.sort().join(", ")}${names.length > 0 ? ", " : ""}` : ""}${names.length > 0 ? names.sort().join(", ") : ""}${option.kind === CommandParameterKinds.string ? ` <${snakeCase(option.choices && option.choices.length > 0 ? option.choices.join("|") : option.format ? option.format : option.name)}${option.variadic ? "..." : ""}>` : option.kind === CommandParameterKinds.number ? ` <${snakeCase(option.choices && option.choices.length > 0 ? option.choices.join("|") : option.name)}${option.variadic ? "..." : ""}>` : ""}"), align: "right", border: "none", maxWidth: "1/3" }, { value: colors.text.body.tertiary(\`${formatShortDescription(option.description).replace(/\.+$/, "").trim()}${option.env || option.default !== void 0 ? ` (${option.env ? `env: ${context.config.appSpecificEnvPrefix}_${option.env}${option.default !== void 0 ? ", " : ""}` : ""}${option.default !== void 0 ? `default: ${JSON.stringify(option.default).replace(/"/g, "\\\"")}` : ""})` : ""}.\`), align: "left", border: "none" }], `;
|
|
72
|
-
}
|
|
73
|
-
}),
|
|
74
|
-
createIntrinsic("hbr", {}),
|
|
75
|
-
code` ]); `
|
|
76
|
-
];
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* A component that generates the commands table display for a command.
|
|
80
|
-
*/
|
|
81
|
-
function HelpCommandsDisplay(props) {
|
|
82
|
-
const { commands } = props;
|
|
83
|
-
return [
|
|
84
|
-
code`table([ `,
|
|
85
|
-
createIntrinsic("hbr", {}),
|
|
86
|
-
createComponent(For, {
|
|
87
|
-
get each() {
|
|
88
|
-
return Object.values(commands);
|
|
89
|
-
},
|
|
90
|
-
hardline: true,
|
|
91
|
-
children: (child) => code`[{ value: colors.text.body.primary("${child.name}"), align: "right", border: "none" }, { value: colors.text.body.tertiary(\`${formatShortDescription(child.description).replace(/\.+$/, "").trim()}.\`), align: "left", border: "none" }], `
|
|
92
|
-
}),
|
|
93
|
-
createIntrinsic("hbr", {}),
|
|
94
|
-
code` ]); `
|
|
95
|
-
];
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* A component that generates the `help` function declaration for a command.
|
|
99
|
-
*/
|
|
100
|
-
function BaseHelpDisplay(props) {
|
|
101
|
-
const { command, indent = 1, filterGlobalOptions = false } = props;
|
|
102
|
-
const theme = useTheme();
|
|
103
|
-
const context = usePowerlines();
|
|
104
|
-
const options = computed(() => filterGlobalOptions ? Object.values(command.options).filter((option) => !context.options.some((globalOption) => globalOption.name === option.name || option.alias.includes(globalOption.name) || globalOption.alias?.includes(option.name) || globalOption.alias?.some((alias) => option.alias.includes(alias)))) : Object.values(command.options));
|
|
105
|
-
return [
|
|
106
|
-
memo(() => code`writeLine(colors.bold(colors.text.heading.secondary("Usage:"))${indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : ""});`),
|
|
107
|
-
createIntrinsic("hbr", {}),
|
|
108
|
-
createComponent(HelpUsageDisplay, {
|
|
109
|
-
command,
|
|
110
|
-
indent
|
|
111
|
-
}),
|
|
112
|
-
createComponent(Spacing, {}),
|
|
113
|
-
createComponent(Show, {
|
|
114
|
-
get when() {
|
|
115
|
-
return options.value.length > 0;
|
|
116
|
-
},
|
|
117
|
-
get children() {
|
|
118
|
-
return [
|
|
119
|
-
memo(() => code`writeLine("");
|
|
120
|
-
writeLine(colors.bold(colors.text.heading.secondary("Options:"))${indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : ""});`),
|
|
121
|
-
createIntrinsic("hbr", {}),
|
|
122
|
-
createComponent(HelpOptionsDisplay, { get options() {
|
|
123
|
-
return options.value;
|
|
124
|
-
} }),
|
|
125
|
-
createComponent(Spacing, {})
|
|
126
|
-
];
|
|
127
|
-
}
|
|
128
|
-
}),
|
|
129
|
-
createComponent(Show, {
|
|
130
|
-
get when() {
|
|
131
|
-
return Object.keys(command.children).length > 0;
|
|
132
|
-
},
|
|
133
|
-
get children() {
|
|
134
|
-
return [
|
|
135
|
-
memo(() => code`writeLine("");
|
|
136
|
-
writeLine(colors.bold(colors.text.heading.secondary("Commands:"))${indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : ""});`),
|
|
137
|
-
createIntrinsic("hbr", {}),
|
|
138
|
-
createComponent(HelpCommandsDisplay, { get commands() {
|
|
139
|
-
return command.children;
|
|
140
|
-
} }),
|
|
141
|
-
createComponent(Spacing, {})
|
|
142
|
-
];
|
|
143
|
-
}
|
|
144
|
-
}),
|
|
145
|
-
createComponent(Show, {
|
|
146
|
-
get when() {
|
|
147
|
-
return isSetString(command.reference);
|
|
148
|
-
},
|
|
149
|
-
get children() {
|
|
150
|
-
return [
|
|
151
|
-
memo(() => code`writeLine("");
|
|
152
|
-
writeLine(colors.text.heading.tertiary(\`More information about this command can be found in the reference documentation at ${command.reference}\`)${indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : ""});`),
|
|
153
|
-
createIntrinsic("hbr", {}),
|
|
154
|
-
createComponent(Spacing, {})
|
|
155
|
-
];
|
|
156
|
-
}
|
|
157
|
-
})
|
|
158
|
-
];
|
|
159
|
-
}
|
|
160
|
-
function sortCommands(commands) {
|
|
161
|
-
return Object.values(commands).sort((a, b) => {
|
|
162
|
-
if (a.tags.some((tag) => tag.toLowerCase() === "deprecated") && !b.tags.some((tag) => tag.toLowerCase() === "deprecated")) return 1;
|
|
163
|
-
else if (!a.tags.some((tag) => tag.toLowerCase() === "deprecated") && b.tags.some((tag) => tag.toLowerCase() === "deprecated")) return -1;
|
|
164
|
-
else if (a.tags.some((tag) => tag.toLowerCase() === "experimental") && !b.tags.some((tag) => tag.toLowerCase() === "experimental")) return 1;
|
|
165
|
-
else if (!a.tags.some((tag) => tag.toLowerCase() === "experimental") && b.tags.some((tag) => tag.toLowerCase() === "experimental")) return -1;
|
|
166
|
-
else if (a.tags.some((tag) => tag.toLowerCase() === "utility") && !b.tags.some((tag) => tag.toLowerCase() === "utility")) return 1;
|
|
167
|
-
else if (!a.tags.some((tag) => tag.toLowerCase() === "utility") && b.tags.some((tag) => tag.toLowerCase() === "utility")) return -1;
|
|
168
|
-
return a.name.localeCompare(b.name);
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* A component that generates the invocation of the `help` function for a command.
|
|
173
|
-
*/
|
|
174
|
-
function VirtualCommandHelpDisplay(props) {
|
|
175
|
-
const { options, segments, commands } = props;
|
|
176
|
-
const context = usePowerlines();
|
|
177
|
-
return [
|
|
178
|
-
createIntrinsic("hbr", {}),
|
|
179
|
-
code`writeLine(colors.bold(colors.text.heading.secondary("Global Options:")));`,
|
|
180
|
-
createIntrinsic("hbr", {}),
|
|
181
|
-
createComponent(HelpOptionsDisplay, { options }),
|
|
182
|
-
code`writeLine(""); `,
|
|
183
|
-
createComponent(Spacing, {}),
|
|
184
|
-
createComponent(Show, {
|
|
185
|
-
get when() {
|
|
186
|
-
return Object.keys(commands).length > 0;
|
|
187
|
-
},
|
|
188
|
-
get children() {
|
|
189
|
-
return [
|
|
190
|
-
memo(() => code`writeLine(colors.text.body.secondary("The following commands are available through the ${getAppTitle(context, true)} command-line interface:"));
|
|
191
|
-
writeLine(""); `),
|
|
192
|
-
createComponent(Spacing, {}),
|
|
193
|
-
createComponent(For, {
|
|
194
|
-
get each() {
|
|
195
|
-
return sortCommands(commands);
|
|
196
|
-
},
|
|
197
|
-
doubleHardline: true,
|
|
198
|
-
joiner: code`writeLine(""); `,
|
|
199
|
-
ender: code`writeLine(""); `,
|
|
200
|
-
children: (child) => [
|
|
201
|
-
memo(() => code`
|
|
202
|
-
writeLine(colors.text.heading.primary(${child.icon ? `(isUnicodeSupported ? " ${child.icon} " : "") + ` : ""}\`${child.title} ${child.isVirtual ? "" : "Command"}${child.tags?.length > 0 ? ` ${child.tags.map((tag) => `\${colors.text.body.tertiary(colors.text.tags.${camelCase(tag)} ? colors.text.tags.${camelCase(tag)}(" ${tag} ", true) : colors.text.tags.$default(" ${tag} ", true))}`).join(" ")}` : ""}\`);
|
|
203
|
-
writeLine("");
|
|
204
|
-
writeLine(colors.text.body.secondary(splitText(\`${formatDescription(child.description).replace(/\.+$/, "").trim()}.\`)));
|
|
205
|
-
writeLine("");
|
|
206
|
-
`),
|
|
207
|
-
createIntrinsic("hbr", {}),
|
|
208
|
-
createComponent(BaseHelpDisplay, {
|
|
209
|
-
command: child,
|
|
210
|
-
indent: 2,
|
|
211
|
-
filterGlobalOptions: true
|
|
212
|
-
}),
|
|
213
|
-
createIntrinsic("hbr", {})
|
|
214
|
-
]
|
|
215
|
-
}),
|
|
216
|
-
memo(() => code`help("Running a specific command with the help flag (via: '${getAppBin(context)}${segments && segments.length > 0 ? ` ${segments.join(" ")}` : ""} <specific command> --help') will provide additional information that is specific to that command.");
|
|
217
|
-
writeLine("");`)
|
|
218
|
-
];
|
|
219
|
-
}
|
|
220
|
-
})
|
|
221
|
-
];
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* A component that generates the invocation of the `help` function for a command.
|
|
225
|
-
*/
|
|
226
|
-
function CommandHelpDisplay(props) {
|
|
227
|
-
const { command } = props;
|
|
228
|
-
const context = usePowerlines();
|
|
229
|
-
return [
|
|
230
|
-
code`writeLine(""); `,
|
|
231
|
-
createComponent(Spacing, {}),
|
|
232
|
-
createComponent(BaseHelpDisplay, {
|
|
233
|
-
command,
|
|
234
|
-
filterGlobalOptions: false
|
|
235
|
-
}),
|
|
236
|
-
code`writeLine(""); `,
|
|
237
|
-
createComponent(Spacing, {}),
|
|
238
|
-
createComponent(Show, {
|
|
239
|
-
get when() {
|
|
240
|
-
return Object.keys(command.children).length > 0;
|
|
241
|
-
},
|
|
242
|
-
get children() {
|
|
243
|
-
return [
|
|
244
|
-
code`writeLine(colors.text.body.secondary("The following sub-commands are available:"));
|
|
245
|
-
writeLine(""); `,
|
|
246
|
-
createComponent(Spacing, {}),
|
|
247
|
-
createComponent(For, {
|
|
248
|
-
get each() {
|
|
249
|
-
return sortCommands(command.children);
|
|
250
|
-
},
|
|
251
|
-
doubleHardline: true,
|
|
252
|
-
joiner: code`writeLine(""); `,
|
|
253
|
-
ender: code`writeLine(""); `,
|
|
254
|
-
children: (child) => [
|
|
255
|
-
memo(() => code`
|
|
256
|
-
writeLine(colors.text.heading.primary(${child.icon ? `(isUnicodeSupported ? " ${child.icon} " : "") + ` : ""}\`${child.title} ${child.isVirtual ? "" : "Command"}${child.tags?.length > 0 ? ` ${child.tags.map((tag) => `\${colors.text.body.tertiary(colors.text.tags.${camelCase(tag)} ? colors.text.tags.${camelCase(tag)}(" ${tag} ", true) : colors.text.tags.$default(" ${tag} ", true))}`).join(" ")}` : ""}\`);
|
|
257
|
-
writeLine("");
|
|
258
|
-
writeLine(colors.text.body.secondary(splitText(\`${formatDescription(child.description).replace(/\.+$/, "").trim()}.\`)));
|
|
259
|
-
writeLine("");
|
|
260
|
-
`),
|
|
261
|
-
createIntrinsic("hbr", {}),
|
|
262
|
-
createComponent(BaseHelpDisplay, {
|
|
263
|
-
command: child,
|
|
264
|
-
indent: 2,
|
|
265
|
-
filterGlobalOptions: true
|
|
266
|
-
}),
|
|
267
|
-
createIntrinsic("hbr", {})
|
|
268
|
-
]
|
|
269
|
-
}),
|
|
270
|
-
memo(() => code`help("Running a specific command with the help flag (via: '${getAppBin(context)} ${command.segments.join(" ")} <specific command> --help') will provide additional information that is specific to that command.");
|
|
271
|
-
writeLine("");`)
|
|
272
|
-
];
|
|
273
|
-
}
|
|
274
|
-
})
|
|
275
|
-
];
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
//#endregion
|
|
279
|
-
export { BaseHelpDisplay, CommandHelpDisplay, HelpCommandsDisplay, HelpOptionsDisplay, HelpUsageDisplay, VirtualCommandHelpDisplay };
|
|
280
|
-
//# sourceMappingURL=display.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"display.mjs","names":[],"sources":["../../../../../plugin-help/dist/components/display.mjs"],"sourcesContent":["import { createComponent, createIntrinsic, memo } from \"@alloy-js/core/jsx-runtime\";\nimport { For, Show, code, computed } from \"@alloy-js/core\";\nimport { formatDescription, formatShortDescription, getAppBin, getAppTitle, getDynamicPathSegmentName, isDynamicPathSegment, sortOptions } from \"@shell-shock/core/plugin-utils\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { CommandParameterKinds } from \"@shell-shock/core\";\nimport { useTheme } from \"@shell-shock/plugin-theme/contexts/theme\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\n\n//#region src/components/display.tsx\n/**\n* A component that generates the usage display for a command.\n*/\nfunction HelpUsageDisplay(props) {\n\tconst { command, indent = 2 } = props;\n\tconst context = usePowerlines();\n\tconst theme = useTheme();\n\treturn [createComponent(For, {\n\t\tget each() {\n\t\t\treturn Object.keys(context.config.bin);\n\t\t},\n\t\thardline: true,\n\t\tchildren: (bin) => [memo(() => code`\n writeLine(\n colors.text.body.secondary(\\`\\${colors.border.app.divider.tertiary(\"\\$_\")} \\${colors.text.usage.bin(\"${bin}\")}${command.segments.length > 0 ? ` ${command.segments.map((segment) => `\\${colors.text.usage.${isDynamicPathSegment(segment) ? \"dynamic\" : \"command\"}(\"${isDynamicPathSegment(segment) ? `[${snakeCase(getDynamicPathSegmentName(segment))}]` : segment}\")}`).join(\" \")}` : \"\"}${Object.values(command.children).length > 0 ? ` \\${colors.text.usage.dynamic(\"[command]\")}` : \"\"}${command.args.length > 0 ? ` ${command.args.map((arg) => `\\${colors.text.usage.args(\"<${snakeCase((arg.kind === CommandParameterKinds.string || arg.kind === CommandParameterKinds.number) && arg.choices && arg.choices.length > 0 ? arg.choices.join(\"|\") : arg.kind === CommandParameterKinds.string && arg.format ? arg.format : arg.name)}${(arg.kind === CommandParameterKinds.string || arg.kind === CommandParameterKinds.number) && arg.variadic ? \"...\" : \"\"}>\")}`).join(\" \")}` : \"\"} \\${colors.text.usage.options(\"[options]\")}\\`), { padding: ${theme.padding.app * indent} }\n );`), createIntrinsic(\"hbr\", {})]\n\t}), createComponent(Show, {\n\t\tget when() {\n\t\t\treturn command.args.length > 0;\n\t\t},\n\t\tget children() {\n\t\t\treturn [createIntrinsic(\"hbr\", {}), createComponent(For, {\n\t\t\t\tget each() {\n\t\t\t\t\treturn Object.keys(context.config.bin);\n\t\t\t\t},\n\t\t\t\thardline: true,\n\t\t\t\tchildren: (bin) => [memo(() => code`\n writeLine(\n colors.text.body.secondary(\\`\\$ \\${colors.text.usage.bin(\"${bin}\")}${command.segments.length > 0 ? ` ${command.segments.map((segment) => `\\${colors.text.usage.${isDynamicPathSegment(segment) ? \"dynamic\" : \"command\"}(\"${isDynamicPathSegment(segment) ? `[${snakeCase(getDynamicPathSegmentName(segment))}]` : segment}\")}`).join(\" \")}` : \"\"}${Object.values(command.children).length > 0 ? ` \\${colors.text.usage.dynamic(\"[command]\")}` : \"\"} \\${colors.text.usage.options(\"[options]\")}${command.args.length > 0 ? ` ${command.args.map((arg) => `\\${colors.text.usage.args(\"<${snakeCase((arg.kind === CommandParameterKinds.string || arg.kind === CommandParameterKinds.number) && arg.choices && arg.choices.length > 0 ? arg.choices.join(\"|\") : arg.kind === CommandParameterKinds.string && arg.format ? arg.format : arg.name)}${(arg.kind === CommandParameterKinds.string || arg.kind === CommandParameterKinds.number) && arg.variadic ? \"...\" : \"\"}>\")}`).join(\" \")}` : \"\"}\\`), { padding: ${theme.padding.app * indent} }\n );`), createIntrinsic(\"hbr\", {})]\n\t\t\t})];\n\t\t}\n\t})];\n}\n/**\n* A component that generates the options table display for a command.\n*/\nfunction HelpOptionsDisplay(props) {\n\tconst { options } = props;\n\tconst context = usePowerlines();\n\treturn [\n\t\tcode`table([ `,\n\t\tcreateIntrinsic(\"hbr\", {}),\n\t\tcreateComponent(For, {\n\t\t\tget each() {\n\t\t\t\treturn sortOptions(options);\n\t\t\t},\n\t\t\thardline: true,\n\t\t\tchildren: (option) => {\n\t\t\t\tconst flags = [];\n\t\t\t\tconst names = [];\n\t\t\t\tif (option.name.length === 1) flags.push(`-${option.name}`);\n\t\t\t\telse names.push(`--${kebabCase(option.name)}`);\n\t\t\t\toption.alias.forEach((alias) => {\n\t\t\t\t\tif (alias.length === 1) flags.push(`-${alias}`);\n\t\t\t\t\telse names.push(`--${kebabCase(alias)}`);\n\t\t\t\t});\n\t\t\t\treturn code`[{ value: colors.text.body.primary(\"${flags.length > 0 ? `${flags.sort().join(\", \")}${names.length > 0 ? \", \" : \"\"}` : \"\"}${names.length > 0 ? names.sort().join(\", \") : \"\"}${option.kind === CommandParameterKinds.string ? ` <${snakeCase(option.choices && option.choices.length > 0 ? option.choices.join(\"|\") : option.format ? option.format : option.name)}${option.variadic ? \"...\" : \"\"}>` : option.kind === CommandParameterKinds.number ? ` <${snakeCase(option.choices && option.choices.length > 0 ? option.choices.join(\"|\") : option.name)}${option.variadic ? \"...\" : \"\"}>` : \"\"}\"), align: \"right\", border: \"none\", maxWidth: \"1/3\" }, { value: colors.text.body.tertiary(\\`${formatShortDescription(option.description).replace(/\\.+$/, \"\").trim()}${option.env || option.default !== void 0 ? ` (${option.env ? `env: ${context.config.appSpecificEnvPrefix}_${option.env}${option.default !== void 0 ? \", \" : \"\"}` : \"\"}${option.default !== void 0 ? `default: ${JSON.stringify(option.default).replace(/\"/g, \"\\\\\\\"\")}` : \"\"})` : \"\"}.\\`), align: \"left\", border: \"none\" }], `;\n\t\t\t}\n\t\t}),\n\t\tcreateIntrinsic(\"hbr\", {}),\n\t\tcode` ]); `\n\t];\n}\n/**\n* A component that generates the commands table display for a command.\n*/\nfunction HelpCommandsDisplay(props) {\n\tconst { commands } = props;\n\treturn [\n\t\tcode`table([ `,\n\t\tcreateIntrinsic(\"hbr\", {}),\n\t\tcreateComponent(For, {\n\t\t\tget each() {\n\t\t\t\treturn Object.values(commands);\n\t\t\t},\n\t\t\thardline: true,\n\t\t\tchildren: (child) => code`[{ value: colors.text.body.primary(\"${child.name}\"), align: \"right\", border: \"none\" }, { value: colors.text.body.tertiary(\\`${formatShortDescription(child.description).replace(/\\.+$/, \"\").trim()}.\\`), align: \"left\", border: \"none\" }], `\n\t\t}),\n\t\tcreateIntrinsic(\"hbr\", {}),\n\t\tcode` ]); `\n\t];\n}\n/**\n* A component that generates the `help` function declaration for a command.\n*/\nfunction BaseHelpDisplay(props) {\n\tconst { command, indent = 1, filterGlobalOptions = false } = props;\n\tconst theme = useTheme();\n\tconst context = usePowerlines();\n\tconst options = computed(() => filterGlobalOptions ? Object.values(command.options).filter((option) => !context.options.some((globalOption) => globalOption.name === option.name || option.alias.includes(globalOption.name) || globalOption.alias?.includes(option.name) || globalOption.alias?.some((alias) => option.alias.includes(alias)))) : Object.values(command.options));\n\treturn [\n\t\tmemo(() => code`writeLine(colors.bold(colors.text.heading.secondary(\"Usage:\"))${indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"});`),\n\t\tcreateIntrinsic(\"hbr\", {}),\n\t\tcreateComponent(HelpUsageDisplay, {\n\t\t\tcommand,\n\t\t\tindent\n\t\t}),\n\t\tcreateComponent(Spacing, {}),\n\t\tcreateComponent(Show, {\n\t\t\tget when() {\n\t\t\t\treturn options.value.length > 0;\n\t\t\t},\n\t\t\tget children() {\n\t\t\t\treturn [\n\t\t\t\t\tmemo(() => code`writeLine(\"\");\n writeLine(colors.bold(colors.text.heading.secondary(\"Options:\"))${indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"});`),\n\t\t\t\t\tcreateIntrinsic(\"hbr\", {}),\n\t\t\t\t\tcreateComponent(HelpOptionsDisplay, { get options() {\n\t\t\t\t\t\treturn options.value;\n\t\t\t\t\t} }),\n\t\t\t\t\tcreateComponent(Spacing, {})\n\t\t\t\t];\n\t\t\t}\n\t\t}),\n\t\tcreateComponent(Show, {\n\t\t\tget when() {\n\t\t\t\treturn Object.keys(command.children).length > 0;\n\t\t\t},\n\t\t\tget children() {\n\t\t\t\treturn [\n\t\t\t\t\tmemo(() => code`writeLine(\"\");\n writeLine(colors.bold(colors.text.heading.secondary(\"Commands:\"))${indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"});`),\n\t\t\t\t\tcreateIntrinsic(\"hbr\", {}),\n\t\t\t\t\tcreateComponent(HelpCommandsDisplay, { get commands() {\n\t\t\t\t\t\treturn command.children;\n\t\t\t\t\t} }),\n\t\t\t\t\tcreateComponent(Spacing, {})\n\t\t\t\t];\n\t\t\t}\n\t\t}),\n\t\tcreateComponent(Show, {\n\t\t\tget when() {\n\t\t\t\treturn isSetString(command.reference);\n\t\t\t},\n\t\t\tget children() {\n\t\t\t\treturn [\n\t\t\t\t\tmemo(() => code`writeLine(\"\");\n writeLine(colors.text.heading.tertiary(\\`More information about this command can be found in the reference documentation at ${command.reference}\\`)${indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"});`),\n\t\t\t\t\tcreateIntrinsic(\"hbr\", {}),\n\t\t\t\t\tcreateComponent(Spacing, {})\n\t\t\t\t];\n\t\t\t}\n\t\t})\n\t];\n}\nfunction sortCommands(commands) {\n\treturn Object.values(commands).sort((a, b) => {\n\t\tif (a.tags.some((tag) => tag.toLowerCase() === \"deprecated\") && !b.tags.some((tag) => tag.toLowerCase() === \"deprecated\")) return 1;\n\t\telse if (!a.tags.some((tag) => tag.toLowerCase() === \"deprecated\") && b.tags.some((tag) => tag.toLowerCase() === \"deprecated\")) return -1;\n\t\telse if (a.tags.some((tag) => tag.toLowerCase() === \"experimental\") && !b.tags.some((tag) => tag.toLowerCase() === \"experimental\")) return 1;\n\t\telse if (!a.tags.some((tag) => tag.toLowerCase() === \"experimental\") && b.tags.some((tag) => tag.toLowerCase() === \"experimental\")) return -1;\n\t\telse if (a.tags.some((tag) => tag.toLowerCase() === \"utility\") && !b.tags.some((tag) => tag.toLowerCase() === \"utility\")) return 1;\n\t\telse if (!a.tags.some((tag) => tag.toLowerCase() === \"utility\") && b.tags.some((tag) => tag.toLowerCase() === \"utility\")) return -1;\n\t\treturn a.name.localeCompare(b.name);\n\t});\n}\n/**\n* A component that generates the invocation of the `help` function for a command.\n*/\nfunction VirtualCommandHelpDisplay(props) {\n\tconst { options, segments, commands } = props;\n\tconst context = usePowerlines();\n\treturn [\n\t\tcreateIntrinsic(\"hbr\", {}),\n\t\tcode`writeLine(colors.bold(colors.text.heading.secondary(\"Global Options:\")));`,\n\t\tcreateIntrinsic(\"hbr\", {}),\n\t\tcreateComponent(HelpOptionsDisplay, { options }),\n\t\tcode`writeLine(\"\"); `,\n\t\tcreateComponent(Spacing, {}),\n\t\tcreateComponent(Show, {\n\t\t\tget when() {\n\t\t\t\treturn Object.keys(commands).length > 0;\n\t\t\t},\n\t\t\tget children() {\n\t\t\t\treturn [\n\t\t\t\t\tmemo(() => code`writeLine(colors.text.body.secondary(\"The following commands are available through the ${getAppTitle(context, true)} command-line interface:\"));\n writeLine(\"\"); `),\n\t\t\t\t\tcreateComponent(Spacing, {}),\n\t\t\t\t\tcreateComponent(For, {\n\t\t\t\t\t\tget each() {\n\t\t\t\t\t\t\treturn sortCommands(commands);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdoubleHardline: true,\n\t\t\t\t\t\tjoiner: code`writeLine(\"\"); `,\n\t\t\t\t\t\tender: code`writeLine(\"\"); `,\n\t\t\t\t\t\tchildren: (child) => [\n\t\t\t\t\t\t\tmemo(() => code`\n writeLine(colors.text.heading.primary(${child.icon ? `(isUnicodeSupported ? \" ${child.icon} \" : \"\") + ` : \"\"}\\`${child.title} ${child.isVirtual ? \"\" : \"Command\"}${child.tags?.length > 0 ? ` ${child.tags.map((tag) => `\\${colors.text.body.tertiary(colors.text.tags.${camelCase(tag)} ? colors.text.tags.${camelCase(tag)}(\" ${tag} \", true) : colors.text.tags.$default(\" ${tag} \", true))}`).join(\" \")}` : \"\"}\\`);\n writeLine(\"\");\n writeLine(colors.text.body.secondary(splitText(\\`${formatDescription(child.description).replace(/\\.+$/, \"\").trim()}.\\`)));\n writeLine(\"\");\n `),\n\t\t\t\t\t\t\tcreateIntrinsic(\"hbr\", {}),\n\t\t\t\t\t\t\tcreateComponent(BaseHelpDisplay, {\n\t\t\t\t\t\t\t\tcommand: child,\n\t\t\t\t\t\t\t\tindent: 2,\n\t\t\t\t\t\t\t\tfilterGlobalOptions: true\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tcreateIntrinsic(\"hbr\", {})\n\t\t\t\t\t\t]\n\t\t\t\t\t}),\n\t\t\t\t\tmemo(() => code`help(\"Running a specific command with the help flag (via: '${getAppBin(context)}${segments && segments.length > 0 ? ` ${segments.join(\" \")}` : \"\"} <specific command> --help') will provide additional information that is specific to that command.\");\n writeLine(\"\");`)\n\t\t\t\t];\n\t\t\t}\n\t\t})\n\t];\n}\n/**\n* A component that generates the invocation of the `help` function for a command.\n*/\nfunction CommandHelpDisplay(props) {\n\tconst { command } = props;\n\tconst context = usePowerlines();\n\treturn [\n\t\tcode`writeLine(\"\"); `,\n\t\tcreateComponent(Spacing, {}),\n\t\tcreateComponent(BaseHelpDisplay, {\n\t\t\tcommand,\n\t\t\tfilterGlobalOptions: false\n\t\t}),\n\t\tcode`writeLine(\"\"); `,\n\t\tcreateComponent(Spacing, {}),\n\t\tcreateComponent(Show, {\n\t\t\tget when() {\n\t\t\t\treturn Object.keys(command.children).length > 0;\n\t\t\t},\n\t\t\tget children() {\n\t\t\t\treturn [\n\t\t\t\t\tcode`writeLine(colors.text.body.secondary(\"The following sub-commands are available:\"));\n writeLine(\"\"); `,\n\t\t\t\t\tcreateComponent(Spacing, {}),\n\t\t\t\t\tcreateComponent(For, {\n\t\t\t\t\t\tget each() {\n\t\t\t\t\t\t\treturn sortCommands(command.children);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdoubleHardline: true,\n\t\t\t\t\t\tjoiner: code`writeLine(\"\"); `,\n\t\t\t\t\t\tender: code`writeLine(\"\"); `,\n\t\t\t\t\t\tchildren: (child) => [\n\t\t\t\t\t\t\tmemo(() => code`\n writeLine(colors.text.heading.primary(${child.icon ? `(isUnicodeSupported ? \" ${child.icon} \" : \"\") + ` : \"\"}\\`${child.title} ${child.isVirtual ? \"\" : \"Command\"}${child.tags?.length > 0 ? ` ${child.tags.map((tag) => `\\${colors.text.body.tertiary(colors.text.tags.${camelCase(tag)} ? colors.text.tags.${camelCase(tag)}(\" ${tag} \", true) : colors.text.tags.$default(\" ${tag} \", true))}`).join(\" \")}` : \"\"}\\`);\n writeLine(\"\");\n writeLine(colors.text.body.secondary(splitText(\\`${formatDescription(child.description).replace(/\\.+$/, \"\").trim()}.\\`)));\n writeLine(\"\");\n `),\n\t\t\t\t\t\t\tcreateIntrinsic(\"hbr\", {}),\n\t\t\t\t\t\t\tcreateComponent(BaseHelpDisplay, {\n\t\t\t\t\t\t\t\tcommand: child,\n\t\t\t\t\t\t\t\tindent: 2,\n\t\t\t\t\t\t\t\tfilterGlobalOptions: true\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tcreateIntrinsic(\"hbr\", {})\n\t\t\t\t\t\t]\n\t\t\t\t\t}),\n\t\t\t\t\tmemo(() => code`help(\"Running a specific command with the help flag (via: '${getAppBin(context)} ${command.segments.join(\" \")} <specific command> --help') will provide additional information that is specific to that command.\");\n writeLine(\"\");`)\n\t\t\t\t];\n\t\t\t}\n\t\t})\n\t];\n}\n\n//#endregion\nexport { BaseHelpDisplay, CommandHelpDisplay, HelpCommandsDisplay, HelpOptionsDisplay, HelpUsageDisplay, VirtualCommandHelpDisplay };\n//# sourceMappingURL=display.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AAgBA,SAAS,iBAAiB,OAAO;CAChC,MAAM,EAAE,SAAS,SAAS,MAAM;CAChC,MAAM,UAAU,eAAe;CAC/B,MAAM,QAAQ,UAAU;AACxB,QAAO,CAAC,gBAAgB,KAAK;EAC5B,IAAI,OAAO;AACV,UAAO,OAAO,KAAK,QAAQ,OAAO,IAAI;;EAEvC,UAAU;EACV,WAAW,QAAQ,CAAC,WAAW,IAAI;;+GAE0E,IAAI,KAAK,QAAQ,SAAS,SAAS,IAAI,IAAI,QAAQ,SAAS,KAAK,YAAY,wBAAwB,qBAAqB,QAAQ,GAAG,YAAY,UAAU,IAAI,qBAAqB,QAAQ,GAAG,IAAI,UAAU,0BAA0B,QAAQ,CAAC,CAAC,KAAK,QAAQ,KAAK,CAAC,KAAK,IAAI,KAAK,KAAK,OAAO,OAAO,QAAQ,SAAS,CAAC,SAAS,IAAI,gDAAgD,KAAK,QAAQ,KAAK,SAA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gB,SAAS,EAAE,CAAC;EAC5B,gBAAgB,MAAM;GACrB,IAAI,OAAO;AACV,WAAO,OAAO,KAAK,QAAQ,SAAS,CAAC,SAAS;;GAE/C,IAAI,WAAW;AACd,WAAO;KACN,IAAI;;KAEJ,gBAAgB,SAAS,EAAE,CAAC;KAC5B,gBAAgB,KAAK;MACpB,IAAI,OAAO;AACV,cAAO,aAAa,QAAQ,SAAS;;MAEtC,gBAAgB;MAChB,QAAQ,IAAI;MACZ,OAAO,IAAI;MACX,WAAW,UAAU;OACpB,WAAW,IAAI;wDACkC,MAAM,OAAO,2BAA2B,MAAM,KAAK,gBAAgB,GAAG,IAAI,MAAM,MAAM,GAAG,MAAM,YAAY,KAAK,YAAY,MAAM,MAAM,SAAS,IAAI,OAAO,MAAM,KAAK,KAAK,QAAQ,iDAAiD,UAAU,IAAI,CAAC,sBAAsB,UAAU,IAAI,CAAC,KAAK,IAAI,0CAA0C,IAAI,aAAa,CAAC,KAAK,IAAI,KAAK,GAAG;;mEAEpW,kBAAkB,MAAM,YAAY,CAAC,QAAQ,QAAQ,GAAG,CAAC,MAAM,CAAC;;kBAEjH;OACX,gBAAgB,OAAO,EAAE,CAAC;OAC1B,gBAAgB,iBAAiB;QAChC,SAAS;QACT,QAAQ;QACR,qBAAqB;QACrB,CAAC;OACF,gBAAgB,OAAO,EAAE,CAAC;OAC1B;MACD,CAAC;KACF,WAAW,IAAI,8DAA8D,UAAU,QAAQ,CAAC,GAAG,QAAQ,SAAS,KAAK,IAAI,CAAC;wBAC3G;KACnB;;GAEF,CAAC;EACF"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
-
const require_display = require('./display.cjs');
|
|
3
|
-
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
4
|
-
let _alloy_js_core = require("@alloy-js/core");
|
|
5
|
-
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
6
|
-
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
7
|
-
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
8
|
-
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
9
|
-
let _powerlines_plugin_alloy_typescript_components_builtin_file = require("@powerlines/plugin-alloy/typescript/components/builtin-file");
|
|
10
|
-
let _stryke_path = require("@stryke/path");
|
|
11
|
-
let defu = require("defu");
|
|
12
|
-
defu = require_runtime.__toESM(defu);
|
|
13
|
-
let _powerlines_plugin_alloy_typescript = require("@powerlines/plugin-alloy/typescript");
|
|
14
|
-
|
|
15
|
-
//#region ../plugin-help/dist/components/help-builtin.mjs
|
|
16
|
-
/**
|
|
17
|
-
* A built-in help module for Shell Shock.
|
|
18
|
-
*/
|
|
19
|
-
function HelpBuiltin(props) {
|
|
20
|
-
const [{ command, children }, rest] = (0, _alloy_js_core.splitProps)(props, ["command", "children"]);
|
|
21
|
-
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
22
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_builtin_file.BuiltinFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({
|
|
23
|
-
get id() {
|
|
24
|
-
return (0, _stryke_path.joinPaths)("help", ...command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)));
|
|
25
|
-
},
|
|
26
|
-
get description() {
|
|
27
|
-
return (0, _alloy_js_core_jsx_runtime.memo)(() => !!command.path)() ? `A collection of utility functions that assist in displaying help information for the ${command.title} command.` : `A collection of utility functions that assist in displaying help information for the ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} command-line interface application.`;
|
|
28
|
-
}
|
|
29
|
-
}, rest, {
|
|
30
|
-
get builtinImports() {
|
|
31
|
-
return (0, defu.default)(rest.builtinImports ?? {}, {
|
|
32
|
-
utils: ["isUnicodeSupported"],
|
|
33
|
-
console: [
|
|
34
|
-
"splitText",
|
|
35
|
-
"writeLine",
|
|
36
|
-
"colors",
|
|
37
|
-
"help",
|
|
38
|
-
"table"
|
|
39
|
-
]
|
|
40
|
-
});
|
|
41
|
-
},
|
|
42
|
-
get children() {
|
|
43
|
-
return [
|
|
44
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
45
|
-
"export": true,
|
|
46
|
-
name: "showHelp",
|
|
47
|
-
get doc() {
|
|
48
|
-
return `Display help information for the ${command.path ? `${command.title} command` : `${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} application`}.`;
|
|
49
|
-
},
|
|
50
|
-
parameters: [],
|
|
51
|
-
get children() {
|
|
52
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
53
|
-
get when() {
|
|
54
|
-
return !command.isVirtual;
|
|
55
|
-
},
|
|
56
|
-
get fallback() {
|
|
57
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_display.VirtualCommandHelpDisplay, {
|
|
58
|
-
get options() {
|
|
59
|
-
return Object.values(command.options);
|
|
60
|
-
},
|
|
61
|
-
get commands() {
|
|
62
|
-
return command.children ?? {};
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
},
|
|
66
|
-
get children() {
|
|
67
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_display.CommandHelpDisplay, { command });
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
}),
|
|
72
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
73
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
74
|
-
get when() {
|
|
75
|
-
return Boolean(children);
|
|
76
|
-
},
|
|
77
|
-
children
|
|
78
|
-
})
|
|
79
|
-
];
|
|
80
|
-
}
|
|
81
|
-
}));
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
//#endregion
|
|
85
|
-
exports.HelpBuiltin = HelpBuiltin;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { CommandHelpDisplay, VirtualCommandHelpDisplay } from "./display.mjs";
|
|
2
|
-
import { createComponent, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
3
|
-
import { Show, code, splitProps } from "@alloy-js/core";
|
|
4
|
-
import { FunctionDeclaration, IfStatement } from "@alloy-js/typescript";
|
|
5
|
-
import { getAppTitle, isDynamicPathSegment } from "@shell-shock/core/plugin-utils";
|
|
6
|
-
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
7
|
-
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
8
|
-
import { BuiltinFile } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
9
|
-
import { joinPaths } from "@stryke/path";
|
|
10
|
-
import defu from "defu";
|
|
11
|
-
import "@powerlines/plugin-alloy/typescript";
|
|
12
|
-
|
|
13
|
-
//#region ../plugin-help/dist/components/help-builtin.mjs
|
|
14
|
-
/**
|
|
15
|
-
* A built-in help module for Shell Shock.
|
|
16
|
-
*/
|
|
17
|
-
function HelpBuiltin(props) {
|
|
18
|
-
const [{ command, children }, rest] = splitProps(props, ["command", "children"]);
|
|
19
|
-
const context = usePowerlines();
|
|
20
|
-
return createComponent(BuiltinFile, mergeProps({
|
|
21
|
-
get id() {
|
|
22
|
-
return joinPaths("help", ...command.segments.filter((segment) => !isDynamicPathSegment(segment)));
|
|
23
|
-
},
|
|
24
|
-
get description() {
|
|
25
|
-
return memo(() => !!command.path)() ? `A collection of utility functions that assist in displaying help information for the ${command.title} command.` : `A collection of utility functions that assist in displaying help information for the ${getAppTitle(context, true)} command-line interface application.`;
|
|
26
|
-
}
|
|
27
|
-
}, rest, {
|
|
28
|
-
get builtinImports() {
|
|
29
|
-
return defu(rest.builtinImports ?? {}, {
|
|
30
|
-
utils: ["isUnicodeSupported"],
|
|
31
|
-
console: [
|
|
32
|
-
"splitText",
|
|
33
|
-
"writeLine",
|
|
34
|
-
"colors",
|
|
35
|
-
"help",
|
|
36
|
-
"table"
|
|
37
|
-
]
|
|
38
|
-
});
|
|
39
|
-
},
|
|
40
|
-
get children() {
|
|
41
|
-
return [
|
|
42
|
-
createComponent(FunctionDeclaration, {
|
|
43
|
-
"export": true,
|
|
44
|
-
name: "showHelp",
|
|
45
|
-
get doc() {
|
|
46
|
-
return `Display help information for the ${command.path ? `${command.title} command` : `${getAppTitle(context, true)} application`}.`;
|
|
47
|
-
},
|
|
48
|
-
parameters: [],
|
|
49
|
-
get children() {
|
|
50
|
-
return createComponent(Show, {
|
|
51
|
-
get when() {
|
|
52
|
-
return !command.isVirtual;
|
|
53
|
-
},
|
|
54
|
-
get fallback() {
|
|
55
|
-
return createComponent(VirtualCommandHelpDisplay, {
|
|
56
|
-
get options() {
|
|
57
|
-
return Object.values(command.options);
|
|
58
|
-
},
|
|
59
|
-
get commands() {
|
|
60
|
-
return command.children ?? {};
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
},
|
|
64
|
-
get children() {
|
|
65
|
-
return createComponent(CommandHelpDisplay, { command });
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}),
|
|
70
|
-
createComponent(Spacing, {}),
|
|
71
|
-
createComponent(Show, {
|
|
72
|
-
get when() {
|
|
73
|
-
return Boolean(children);
|
|
74
|
-
},
|
|
75
|
-
children
|
|
76
|
-
})
|
|
77
|
-
];
|
|
78
|
-
}
|
|
79
|
-
}));
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
//#endregion
|
|
83
|
-
export { HelpBuiltin };
|
|
84
|
-
//# sourceMappingURL=help-builtin.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"help-builtin.mjs","names":[],"sources":["../../../../../plugin-help/dist/components/help-builtin.mjs"],"sourcesContent":["import { CommandHelpDisplay, VirtualCommandHelpDisplay } from \"./display.mjs\";\nimport { createComponent, memo, mergeProps } from \"@alloy-js/core/jsx-runtime\";\nimport { Show, code, splitProps } from \"@alloy-js/core\";\nimport { getAppTitle, isDynamicPathSegment } from \"@shell-shock/core/plugin-utils\";\nimport defu from \"defu\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { FunctionDeclaration, IfStatement } from \"@alloy-js/typescript\";\nimport { TSDoc, TSDocRemarks, TSDocReturns } from \"@powerlines/plugin-alloy/typescript\";\nimport { BuiltinFile } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport { joinPaths } from \"@stryke/path\";\n\n//#region src/components/help-builtin.tsx\n/**\n* The `updateVersionCheckFile` handler function declaration code for the Shell Shock project.\n*/\nfunction HelpFunctionDeclaration() {\n\treturn [createComponent(TSDoc, {\n\t\theading: \"A helper function that updates the version check file.\",\n\t\tget children() {\n\t\t\treturn [\n\t\t\t\tcreateComponent(TSDocRemarks, { children: `This function is used to update the version check file with the current timestamp. It can be used in the CLI upgrade command to record the last time a check for updates was performed. The function writes a \"version-check.json\" file in the data directory, which contains a timestamp of the last check for updates.` }),\n\t\t\t\tcreateComponent(Spacing, {}),\n\t\t\t\tcreateComponent(TSDocReturns, { children: `A promise that resolves to a boolean indicating whether a check for updates is required.` })\n\t\t\t];\n\t\t}\n\t}), createComponent(FunctionDeclaration, {\n\t\t\"export\": true,\n\t\tasync: true,\n\t\tname: \"updateVersionCheckFile\",\n\t\treturnType: \"void\",\n\t\tget children() {\n\t\t\treturn [createComponent(IfStatement, {\n\t\t\t\tcondition: code`!existsSync(paths.data)`,\n\t\t\t\tchildren: code`await mkdir(paths.data, { recursive: true }); `\n\t\t\t}), code`await writeFile(join(paths.data, \"version-check.json\"), JSON.stringify({ timestamp: new Date().getTime() }), \"utf8\"); `];\n\t\t}\n\t})];\n}\n/**\n* A built-in help module for Shell Shock.\n*/\nfunction HelpBuiltin(props) {\n\tconst [{ command, children }, rest] = splitProps(props, [\"command\", \"children\"]);\n\tconst context = usePowerlines();\n\treturn createComponent(BuiltinFile, mergeProps({\n\t\tget id() {\n\t\t\treturn joinPaths(\"help\", ...command.segments.filter((segment) => !isDynamicPathSegment(segment)));\n\t\t},\n\t\tget description() {\n\t\t\treturn memo(() => !!command.path)() ? `A collection of utility functions that assist in displaying help information for the ${command.title} command.` : `A collection of utility functions that assist in displaying help information for the ${getAppTitle(context, true)} command-line interface application.`;\n\t\t}\n\t}, rest, {\n\t\tget builtinImports() {\n\t\t\treturn defu(rest.builtinImports ?? {}, {\n\t\t\t\tutils: [\"isUnicodeSupported\"],\n\t\t\t\tconsole: [\n\t\t\t\t\t\"splitText\",\n\t\t\t\t\t\"writeLine\",\n\t\t\t\t\t\"colors\",\n\t\t\t\t\t\"help\",\n\t\t\t\t\t\"table\"\n\t\t\t\t]\n\t\t\t});\n\t\t},\n\t\tget children() {\n\t\t\treturn [\n\t\t\t\tcreateComponent(FunctionDeclaration, {\n\t\t\t\t\t\"export\": true,\n\t\t\t\t\tname: \"showHelp\",\n\t\t\t\t\tget doc() {\n\t\t\t\t\t\treturn `Display help information for the ${command.path ? `${command.title} command` : `${getAppTitle(context, true)} application`}.`;\n\t\t\t\t\t},\n\t\t\t\t\tparameters: [],\n\t\t\t\t\tget children() {\n\t\t\t\t\t\treturn createComponent(Show, {\n\t\t\t\t\t\t\tget when() {\n\t\t\t\t\t\t\t\treturn !command.isVirtual;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tget fallback() {\n\t\t\t\t\t\t\t\treturn createComponent(VirtualCommandHelpDisplay, {\n\t\t\t\t\t\t\t\t\tget options() {\n\t\t\t\t\t\t\t\t\t\treturn Object.values(command.options);\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tget commands() {\n\t\t\t\t\t\t\t\t\t\treturn command.children ?? {};\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tget children() {\n\t\t\t\t\t\t\t\treturn createComponent(CommandHelpDisplay, { command });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\tcreateComponent(Spacing, {}),\n\t\t\t\tcreateComponent(Show, {\n\t\t\t\t\tget when() {\n\t\t\t\t\t\treturn Boolean(children);\n\t\t\t\t\t},\n\t\t\t\t\tchildren\n\t\t\t\t})\n\t\t\t];\n\t\t}\n\t}));\n}\n\n//#endregion\nexport { HelpBuiltin, HelpFunctionDeclaration };\n//# sourceMappingURL=help-builtin.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AA0CA,SAAS,YAAY,OAAO;CAC3B,MAAM,CAAC,EAAE,SAAS,YAAY,QAAQ,WAAW,OAAO,CAAC,WAAW,WAAW,CAAC;CAChF,MAAM,UAAU,eAAe;AAC/B,QAAO,gBAAgB,aAAa,WAAW;EAC9C,IAAI,KAAK;AACR,UAAO,UAAU,QAAQ,GAAG,QAAQ,SAAS,QAAQ,YAAY,CAAC,qBAAqB,QAAQ,CAAC,CAAC;;EAElG,IAAI,cAAc;AACjB,UAAO,WAAW,CAAC,CAAC,QAAQ,KAAK,EAAE,GAAG,wFAAwF,QAAQ,MAAM,aAAa,wFAAwF,YAAY,SAAS,KAAK,CAAC;;EAE7Q,EAAE,MAAM;EACR,IAAI,iBAAiB;AACpB,UAAO,KAAK,KAAK,kBAAkB,EAAE,EAAE;IACtC,OAAO,CAAC,qBAAqB;IAC7B,SAAS;KACR;KACA;KACA;KACA;KACA;KACA;IACD,CAAC;;EAEH,IAAI,WAAW;AACd,UAAO;IACN,gBAAgB,qBAAqB;KACpC,UAAU;KACV,MAAM;KACN,IAAI,MAAM;AACT,aAAO,oCAAoC,QAAQ,OAAO,GAAG,QAAQ,MAAM,YAAY,GAAG,YAAY,SAAS,KAAK,CAAC,cAAc;;KAEpI,YAAY,EAAE;KACd,IAAI,WAAW;AACd,aAAO,gBAAgB,MAAM;OAC5B,IAAI,OAAO;AACV,eAAO,CAAC,QAAQ;;OAEjB,IAAI,WAAW;AACd,eAAO,gBAAgB,2BAA2B;SACjD,IAAI,UAAU;AACb,iBAAO,OAAO,OAAO,QAAQ,QAAQ;;SAEtC,IAAI,WAAW;AACd,iBAAO,QAAQ,YAAY,EAAE;;SAE9B,CAAC;;OAEH,IAAI,WAAW;AACd,eAAO,gBAAgB,oBAAoB,EAAE,SAAS,CAAC;;OAExD,CAAC;;KAEH,CAAC;IACF,gBAAgB,SAAS,EAAE,CAAC;IAC5B,gBAAgB,MAAM;KACrB,IAAI,OAAO;AACV,aAAO,QAAQ,SAAS;;KAEzB;KACA,CAAC;IACF;;EAEF,CAAC,CAAC"}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
-
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
3
|
-
let _alloy_js_core = require("@alloy-js/core");
|
|
4
|
-
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
5
|
-
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
6
|
-
let _stryke_path = require("@stryke/path");
|
|
7
|
-
let _powerlines_plugin_alloy_typescript = require("@powerlines/plugin-alloy/typescript");
|
|
8
|
-
let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
9
|
-
let _powerlines_plugin_alloy_core = require("@powerlines/plugin-alloy/core");
|
|
10
|
-
let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
11
|
-
|
|
12
|
-
//#region ../plugin-help/dist/components/help-command.mjs
|
|
13
|
-
/**
|
|
14
|
-
* The Help command's handler wrapper for the Shell Shock project.
|
|
15
|
-
*/
|
|
16
|
-
function HelpCommand() {
|
|
17
|
-
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
18
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TypescriptFile, {
|
|
19
|
-
get path() {
|
|
20
|
-
return (0, _stryke_path.joinPaths)(context.entryPath, "help", "command.ts");
|
|
21
|
-
},
|
|
22
|
-
imports: {
|
|
23
|
-
"node:os": ["os"],
|
|
24
|
-
"node:fs/promises": ["readFile", "writeFile"]
|
|
25
|
-
},
|
|
26
|
-
builtinImports: { console: [
|
|
27
|
-
"colors",
|
|
28
|
-
"writeLine",
|
|
29
|
-
"success",
|
|
30
|
-
"warn",
|
|
31
|
-
"stripAnsi"
|
|
32
|
-
] },
|
|
33
|
-
get children() {
|
|
34
|
-
return [
|
|
35
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Options for the Help command." }),
|
|
36
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
37
|
-
"export": true,
|
|
38
|
-
name: "HelpOptions",
|
|
39
|
-
get children() {
|
|
40
|
-
return [
|
|
41
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
42
|
-
heading: "Whether to help to the latest version.",
|
|
43
|
-
get children() {
|
|
44
|
-
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `If set to \`true\`, the command will attempt to help to the latest version. This option takes precedence over the \`version\` option.` }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
|
|
45
|
-
get type() {
|
|
46
|
-
return _powerlines_deepkit_vendor_type.ReflectionKind.boolean;
|
|
47
|
-
},
|
|
48
|
-
defaultValue: false
|
|
49
|
-
})];
|
|
50
|
-
}
|
|
51
|
-
}),
|
|
52
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
53
|
-
name: "latest",
|
|
54
|
-
optional: true,
|
|
55
|
-
type: "boolean"
|
|
56
|
-
}),
|
|
57
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
|
|
58
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
59
|
-
heading: "A specific application version to help to.",
|
|
60
|
-
get children() {
|
|
61
|
-
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `The command will attempt to help to the specified version. The version should be a valid semantic version string, or \`latest\` to help to the latest version.` }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
|
|
62
|
-
get type() {
|
|
63
|
-
return _powerlines_deepkit_vendor_type.ReflectionKind.string;
|
|
64
|
-
},
|
|
65
|
-
defaultValue: "latest"
|
|
66
|
-
})];
|
|
67
|
-
}
|
|
68
|
-
}),
|
|
69
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
70
|
-
name: "version",
|
|
71
|
-
optional: true,
|
|
72
|
-
type: "string"
|
|
73
|
-
})
|
|
74
|
-
];
|
|
75
|
-
}
|
|
76
|
-
}),
|
|
77
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
|
|
78
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Handler logic for the \\`help\\` command." }),
|
|
79
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
80
|
-
"export": true,
|
|
81
|
-
"default": true,
|
|
82
|
-
async: true,
|
|
83
|
-
name: "handler",
|
|
84
|
-
parameters: [{
|
|
85
|
-
name: "options",
|
|
86
|
-
type: "HelpOptions"
|
|
87
|
-
}],
|
|
88
|
-
children: _alloy_js_core.code` return;`
|
|
89
|
-
})
|
|
90
|
-
];
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
//#endregion
|
|
96
|
-
exports.HelpCommand = HelpCommand;
|