@shell-shock/plugin-help 0.2.25 → 0.2.26
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/_virtual/_rolldown/runtime.cjs +1 -29
- package/dist/components/display.cjs +18 -278
- package/dist/components/display.mjs +18 -271
- package/dist/components/display.mjs.map +1 -1
- package/dist/components/help-builtin.cjs +1 -99
- package/dist/components/help-builtin.mjs +1 -96
- package/dist/components/help-builtin.mjs.map +1 -1
- package/dist/components/help-command.cjs +1 -152
- package/dist/components/help-command.mjs +1 -149
- package/dist/components/help-command.mjs.map +1 -1
- package/dist/components/index.cjs +1 -14
- package/dist/components/index.mjs +1 -5
- package/dist/index.cjs +1 -98
- package/dist/index.mjs +1 -92
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/package.json +15 -15
|
@@ -1,29 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
-
__defProp(to, key, {
|
|
14
|
-
get: ((k) => from[k]).bind(null, key),
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
-
value: mod,
|
|
24
|
-
enumerable: true
|
|
25
|
-
}) : target, mod));
|
|
26
|
-
|
|
27
|
-
//#endregion
|
|
28
|
-
|
|
29
|
-
exports.__toESM = __toESM;
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
|
|
@@ -1,282 +1,22 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.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 _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
6
|
-
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
7
|
-
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
8
|
-
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
9
|
-
let _shell_shock_core = require("@shell-shock/core");
|
|
10
|
-
let _shell_shock_plugin_theme_contexts_theme = require("@shell-shock/plugin-theme/contexts/theme");
|
|
11
|
-
let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
12
|
-
let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
13
|
-
let _stryke_string_format_snake_case = require("@stryke/string-format/snake-case");
|
|
14
|
-
|
|
15
|
-
//#region src/components/display.tsx
|
|
16
|
-
/**
|
|
17
|
-
* A component that generates the usage display for a command.
|
|
18
|
-
*/
|
|
19
|
-
function HelpUsageDisplay(props) {
|
|
20
|
-
const { command, indent = 2 } = props;
|
|
21
|
-
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
22
|
-
const theme = (0, _shell_shock_plugin_theme_contexts_theme.useTheme)();
|
|
23
|
-
return [
|
|
24
|
-
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`@alloy-js/core/jsx-runtime`),t=require(`@alloy-js/core`),n=require(`@shell-shock/core/plugin-utils`),r=require(`@stryke/type-checks/is-set-string`),i=require(`@powerlines/plugin-alloy/core/components/spacing`),a=require(`@powerlines/plugin-alloy/core/contexts/context`),o=require(`@shell-shock/core`),s=require(`@shell-shock/plugin-theme/contexts/theme`),c=require(`@stryke/string-format/camel-case`),l=require(`@stryke/string-format/kebab-case`),u=require(`@stryke/string-format/snake-case`);function d(r){let{command:i,indent:c=2}=r,l=(0,a.usePowerlines)(),d=(0,s.useTheme)();return[(0,e.memo)(()=>t.code`
|
|
25
2
|
writeLine(
|
|
26
|
-
textColors.body.secondary(\`\${textColors.usage.bin("$_ ${(0,
|
|
27
|
-
);`),
|
|
28
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
29
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
30
|
-
get when() {
|
|
31
|
-
return command.args.length > 0;
|
|
32
|
-
},
|
|
33
|
-
get children() {
|
|
34
|
-
return [
|
|
35
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
36
|
-
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`
|
|
3
|
+
textColors.body.secondary(\`\${textColors.usage.bin("$_ ${(0,n.getAppBin)(l)}")}${i.segments.length>0?` ${i.segments.map(e=>`\${textColors.usage.${(0,n.isDynamicPathSegment)(e)?`dynamic`:`command`}("${(0,n.isDynamicPathSegment)(e)?`[${(0,u.snakeCase)((0,n.getDynamicPathSegmentName)(e))}]`:e}")}`).join(` `)}`:``}${Object.values(i.children).length>0?' ${textColors.usage.dynamic("[command]")}':``}${i.args.length>0?` ${i.args.map(e=>`\${textColors.usage.args("<${(0,u.snakeCase)((e.kind===o.CommandParameterKinds.string||e.kind===o.CommandParameterKinds.number)&&e.choices&&e.choices.length>0?e.choices.join(`|`):e.kind===o.CommandParameterKinds.string&&e.format?e.format:e.name)}${(e.kind===o.CommandParameterKinds.string||e.kind===o.CommandParameterKinds.number)&&e.variadic?`...`:``}>")}`).join(` `)}`:``} \${textColors.usage.options("[options]")}\`), { padding: ${d.padding.app*c} }
|
|
4
|
+
);`),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(t.Show,{get when(){return i.args.length>0},get children(){return[(0,e.createIntrinsic)(`hbr`,{}),(0,e.memo)(()=>t.code`
|
|
37
5
|
writeLine(
|
|
38
|
-
textColors.body.secondary(\`\${textColors.usage.bin("$_ ${(0,
|
|
39
|
-
);`),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* A component that generates the options table display for a command.
|
|
48
|
-
*/
|
|
49
|
-
function HelpOptionsDisplay(props) {
|
|
50
|
-
const { options } = props;
|
|
51
|
-
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
52
|
-
return [
|
|
53
|
-
_alloy_js_core.code`table([ `,
|
|
54
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
55
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
56
|
-
get each() {
|
|
57
|
-
return (0, _shell_shock_core_plugin_utils.sortOptions)(options);
|
|
58
|
-
},
|
|
59
|
-
hardline: true,
|
|
60
|
-
children: (option) => {
|
|
61
|
-
const flags = [];
|
|
62
|
-
const names = [];
|
|
63
|
-
if (option.name.length === 1) flags.push(`-${option.name}`);
|
|
64
|
-
else names.push(`--${(0, _stryke_string_format_kebab_case.kebabCase)(option.name)}`);
|
|
65
|
-
option.alias.forEach((alias) => {
|
|
66
|
-
if (alias.length === 1) flags.push(`-${alias}`);
|
|
67
|
-
else names.push(`--${(0, _stryke_string_format_kebab_case.kebabCase)(alias)}`);
|
|
68
|
-
});
|
|
69
|
-
return _alloy_js_core.code`[{ value: textColors.body.primary("${flags.length > 0 ? `${flags.sort().join(", ")}${names.length > 0 ? ", " : ""}` : ""}${names.length > 0 ? names.sort().join(", ") : ""}${option.kind === _shell_shock_core.CommandParameterKinds.string ? ` <${(0, _stryke_string_format_snake_case.snakeCase)(option.choices && option.choices.length > 0 ? option.choices.join("|") : option.format ? option.format : option.name)}${option.variadic ? "..." : ""}>` : option.kind === _shell_shock_core.CommandParameterKinds.number ? ` <${(0, _stryke_string_format_snake_case.snakeCase)(option.choices && option.choices.length > 0 ? option.choices.join("|") : option.name)}${option.variadic ? "..." : ""}>` : ""}"), align: "right", border: "none", maxWidth: "1/3" }, { value: textColors.body.tertiary(\`${(0, _shell_shock_core_plugin_utils.formatShortDescription)(option.description, { length: 200 }).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" }], `;
|
|
70
|
-
}
|
|
71
|
-
}),
|
|
72
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
73
|
-
_alloy_js_core.code` ]); `
|
|
74
|
-
];
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* A component that generates the commands table display for a command.
|
|
78
|
-
*/
|
|
79
|
-
function HelpCommandsDisplay(props) {
|
|
80
|
-
const { commands } = props;
|
|
81
|
-
return [
|
|
82
|
-
_alloy_js_core.code`table([ `,
|
|
83
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
84
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
85
|
-
get each() {
|
|
86
|
-
return Object.values(commands);
|
|
87
|
-
},
|
|
88
|
-
hardline: true,
|
|
89
|
-
children: (child) => _alloy_js_core.code`[{ value: textColors.body.primary("${child.name}"), align: "right", border: "none" }, { value: textColors.body.tertiary(\`${(0, _shell_shock_core_plugin_utils.formatShortDescription)(child.description, { length: 200 }).replace(/\.+$/, "").trim()}.\`), align: "left", border: "none" }], `
|
|
90
|
-
}),
|
|
91
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
92
|
-
_alloy_js_core.code` ]); `
|
|
93
|
-
];
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* A component that generates the `help` function declaration for a command.
|
|
97
|
-
*/
|
|
98
|
-
function BaseHelpDisplay(props) {
|
|
99
|
-
const { command, indent = 1, filterGlobalOptions = false } = props;
|
|
100
|
-
const theme = (0, _shell_shock_plugin_theme_contexts_theme.useTheme)();
|
|
101
|
-
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
102
|
-
const options = (0, _alloy_js_core.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));
|
|
103
|
-
return [
|
|
104
|
-
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`writeLine(bold(textColors.heading.secondary("Usage:"))${indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : ""});`),
|
|
105
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
106
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(HelpUsageDisplay, {
|
|
107
|
-
command,
|
|
108
|
-
indent
|
|
109
|
-
}),
|
|
110
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
111
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
112
|
-
get when() {
|
|
113
|
-
return options.value.length > 0;
|
|
114
|
-
},
|
|
115
|
-
get children() {
|
|
116
|
-
return [
|
|
117
|
-
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`writeLine("");
|
|
118
|
-
writeLine(bold(textColors.heading.secondary("Options:"))${indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : ""});`),
|
|
119
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
120
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(HelpOptionsDisplay, { get options() {
|
|
121
|
-
return options.value;
|
|
122
|
-
} }),
|
|
123
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
|
|
124
|
-
];
|
|
125
|
-
}
|
|
126
|
-
}),
|
|
127
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
128
|
-
get when() {
|
|
129
|
-
return Object.keys(command.children).length > 0;
|
|
130
|
-
},
|
|
131
|
-
get children() {
|
|
132
|
-
return [
|
|
133
|
-
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`writeLine("");
|
|
134
|
-
writeLine(bold(textColors.heading.secondary("Commands:"))${indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : ""});`),
|
|
135
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
136
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(HelpCommandsDisplay, { get commands() {
|
|
137
|
-
return command.children;
|
|
138
|
-
} }),
|
|
139
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
|
|
140
|
-
];
|
|
141
|
-
}
|
|
142
|
-
}),
|
|
143
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
144
|
-
get when() {
|
|
145
|
-
return (0, _stryke_type_checks_is_set_string.isSetString)(command.reference);
|
|
146
|
-
},
|
|
147
|
-
get children() {
|
|
148
|
-
return [
|
|
149
|
-
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`writeLine("");
|
|
150
|
-
writeLine(textColors.heading.tertiary(\`More information about this command can be found in the reference documentation at \${link("${command.reference}")}\`)${indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : ""});`),
|
|
151
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
152
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
|
|
153
|
-
];
|
|
154
|
-
}
|
|
155
|
-
})
|
|
156
|
-
];
|
|
157
|
-
}
|
|
158
|
-
function sortCommands(commands) {
|
|
159
|
-
return Object.values(commands).sort((a, b) => {
|
|
160
|
-
if (a.tags.some((tag) => tag.toLowerCase() === "deprecated") && !b.tags.some((tag) => tag.toLowerCase() === "deprecated")) return 1;
|
|
161
|
-
else if (!a.tags.some((tag) => tag.toLowerCase() === "deprecated") && b.tags.some((tag) => tag.toLowerCase() === "deprecated")) return -1;
|
|
162
|
-
else if (a.tags.some((tag) => tag.toLowerCase() === "experimental") && !b.tags.some((tag) => tag.toLowerCase() === "experimental")) return 1;
|
|
163
|
-
else if (!a.tags.some((tag) => tag.toLowerCase() === "experimental") && b.tags.some((tag) => tag.toLowerCase() === "experimental")) return -1;
|
|
164
|
-
else if (a.tags.some((tag) => tag.toLowerCase() === "utility") && !b.tags.some((tag) => tag.toLowerCase() === "utility")) return 1;
|
|
165
|
-
else if (!a.tags.some((tag) => tag.toLowerCase() === "utility") && b.tags.some((tag) => tag.toLowerCase() === "utility")) return -1;
|
|
166
|
-
return a.name.localeCompare(b.name);
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* A component that generates the invocation of the `help` function for a command.
|
|
171
|
-
*/
|
|
172
|
-
function VirtualCommandHelpDisplay(props) {
|
|
173
|
-
const { options, segments, commands } = props;
|
|
174
|
-
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
175
|
-
return [
|
|
176
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
177
|
-
_alloy_js_core.code`writeLine(bold(textColors.heading.secondary("Common Options:")));`,
|
|
178
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
179
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(HelpOptionsDisplay, { options }),
|
|
180
|
-
_alloy_js_core.code`writeLine(""); `,
|
|
181
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
182
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
183
|
-
get when() {
|
|
184
|
-
return Object.keys(commands).length > 0;
|
|
185
|
-
},
|
|
186
|
-
get children() {
|
|
187
|
-
return [
|
|
188
|
-
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`writeLine(textColors.body.tertiary("The following commands are available through the ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} command-line interface:"));
|
|
189
|
-
writeLine(""); `),
|
|
190
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
191
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
192
|
-
get each() {
|
|
193
|
-
return sortCommands(commands);
|
|
194
|
-
},
|
|
195
|
-
doubleHardline: true,
|
|
196
|
-
joiner: _alloy_js_core.code`writeLine(""); `,
|
|
197
|
-
ender: _alloy_js_core.code`writeLine(""); `,
|
|
198
|
-
children: (child) => [
|
|
199
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
200
|
-
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`
|
|
201
|
-
writeLine(textColors.heading.primary(${child.icon ? `(isUnicodeSupported ? " ${child.icon} " : "") + ` : ""}\`${child.title} ${child.isVirtual ? "" : "Command"}${child.tags?.length > 0 ? ` - ${child.tags.map((tag) => `\${textColors.tags.${(0, _stryke_string_format_camel_case.camelCase)(tag)} ? textColors.tags.${(0, _stryke_string_format_camel_case.camelCase)(tag)}(inverse(" ${tag} ")) : textColors.tags.$default(inverse(" ${tag} "))}`).join(" ")}` : ""}\`));
|
|
6
|
+
textColors.body.secondary(\`\${textColors.usage.bin("$_ ${(0,n.getAppBin)(l)}")}${i.segments.length>0?` ${i.segments.map(e=>`\${textColors.usage.${(0,n.isDynamicPathSegment)(e)?`dynamic`:`command`}("${(0,n.isDynamicPathSegment)(e)?`[${(0,u.snakeCase)((0,n.getDynamicPathSegmentName)(e))}]`:e}")}`).join(` `)}`:``}${Object.values(i.children).length>0?' ${textColors.usage.dynamic("[command]")}':``} \${textColors.usage.options("[options]")}${i.args.length>0?` ${i.args.map(e=>`\${textColors.usage.args("<${(0,u.snakeCase)((e.kind===o.CommandParameterKinds.string||e.kind===o.CommandParameterKinds.number)&&e.choices&&e.choices.length>0?e.choices.join(`|`):e.kind===o.CommandParameterKinds.string&&e.format?e.format:e.name)}${(e.kind===o.CommandParameterKinds.string||e.kind===o.CommandParameterKinds.number)&&e.variadic?`...`:``}>")}`).join(` `)}`:``}\`), { padding: ${d.padding.app*c} }
|
|
7
|
+
);`),(0,e.createIntrinsic)(`hbr`,{})]}})]}function f(r){let{options:i}=r,s=(0,a.usePowerlines)();return[t.code`table([ `,(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(t.For,{get each(){return(0,n.sortOptions)(i)},hardline:!0,children:e=>{let r=[],i=[];return e.name.length===1?r.push(`-${e.name}`):i.push(`--${(0,l.kebabCase)(e.name)}`),e.alias.forEach(e=>{e.length===1?r.push(`-${e}`):i.push(`--${(0,l.kebabCase)(e)}`)}),t.code`[{ value: textColors.body.primary("${r.length>0?`${r.sort().join(`, `)}${i.length>0?`, `:``}`:``}${i.length>0?i.sort().join(`, `):``}${e.kind===o.CommandParameterKinds.string?` <${(0,u.snakeCase)(e.choices&&e.choices.length>0?e.choices.join(`|`):e.format?e.format:e.name)}${e.variadic?`...`:``}>`:e.kind===o.CommandParameterKinds.number?` <${(0,u.snakeCase)(e.choices&&e.choices.length>0?e.choices.join(`|`):e.name)}${e.variadic?`...`:``}>`:``}"), align: "right", border: "none", maxWidth: "1/3" }, { value: textColors.body.tertiary(\`${(0,n.formatShortDescription)(e.description,{length:200}).replace(/\.+$/,``).trim()}${e.env||e.default!==void 0?` (${e.env?`env: ${s.config.appSpecificEnvPrefix}_${e.env}${e.default===void 0?``:`, `}`:``}${e.default===void 0?``:`default: ${JSON.stringify(e.default).replace(/"/g,`\\"`)}`})`:``}.\`), align: "left", border: "none" }], `}}),(0,e.createIntrinsic)(`hbr`,{}),t.code` ]); `]}function p(r){let{commands:i}=r;return[t.code`table([ `,(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(t.For,{get each(){return Object.values(i)},hardline:!0,children:e=>t.code`[{ value: textColors.body.primary("${e.name}"), align: "right", border: "none" }, { value: textColors.body.tertiary(\`${(0,n.formatShortDescription)(e.description,{length:200}).replace(/\.+$/,``).trim()}.\`), align: "left", border: "none" }], `}),(0,e.createIntrinsic)(`hbr`,{}),t.code` ]); `]}function m(n){let{command:o,indent:c=1,filterGlobalOptions:l=!1}=n,u=(0,s.useTheme)(),m=(0,a.usePowerlines)(),h=(0,t.computed)(()=>l?Object.values(o.options).filter(e=>!m.globalOptions.some(t=>t.name===e.name||e.alias.includes(t.name)||t.alias?.includes(e.name)||t.alias?.some(t=>e.alias.includes(t)))):Object.values(o.options));return[(0,e.memo)(()=>t.code`writeLine(bold(textColors.heading.secondary("Usage:"))${c>1?`, { padding: ${u.padding.app*c} }`:``});`),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(d,{command:o,indent:c}),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(t.Show,{get when(){return h.value.length>0},get children(){return[(0,e.memo)(()=>t.code`writeLine("");
|
|
8
|
+
writeLine(bold(textColors.heading.secondary("Options:"))${c>1?`, { padding: ${u.padding.app*c} }`:``});`),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(f,{get options(){return h.value}}),(0,e.createComponent)(i.Spacing,{})]}}),(0,e.createComponent)(t.Show,{get when(){return Object.keys(o.children).length>0},get children(){return[(0,e.memo)(()=>t.code`writeLine("");
|
|
9
|
+
writeLine(bold(textColors.heading.secondary("Commands:"))${c>1?`, { padding: ${u.padding.app*c} }`:``});`),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(p,{get commands(){return o.children}}),(0,e.createComponent)(i.Spacing,{})]}}),(0,e.createComponent)(t.Show,{get when(){return(0,r.isSetString)(o.reference)},get children(){return[(0,e.memo)(()=>t.code`writeLine("");
|
|
10
|
+
writeLine(textColors.heading.tertiary(\`More information about this command can be found in the reference documentation at \${link("${o.reference}")}\`)${c>1?`, { padding: ${u.padding.app*c} }`:``});`),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(i.Spacing,{})]}})]}function h(e){return Object.values(e).sort((e,t)=>e.tags.some(e=>e.toLowerCase()===`deprecated`)&&!t.tags.some(e=>e.toLowerCase()===`deprecated`)?1:!e.tags.some(e=>e.toLowerCase()===`deprecated`)&&t.tags.some(e=>e.toLowerCase()===`deprecated`)?-1:e.tags.some(e=>e.toLowerCase()===`experimental`)&&!t.tags.some(e=>e.toLowerCase()===`experimental`)?1:!e.tags.some(e=>e.toLowerCase()===`experimental`)&&t.tags.some(e=>e.toLowerCase()===`experimental`)?-1:e.tags.some(e=>e.toLowerCase()===`utility`)&&!t.tags.some(e=>e.toLowerCase()===`utility`)?1:!e.tags.some(e=>e.toLowerCase()===`utility`)&&t.tags.some(e=>e.toLowerCase()===`utility`)?-1:e.name.localeCompare(t.name))}function g(r){let{options:o,segments:s,commands:l}=r,u=(0,a.usePowerlines)();return[(0,e.createIntrinsic)(`hbr`,{}),t.code`writeLine(bold(textColors.heading.secondary("Common Options:")));`,(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(f,{options:o}),t.code`writeLine(""); `,(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(t.Show,{get when(){return Object.keys(l).length>0},get children(){return[(0,e.memo)(()=>t.code`writeLine(textColors.body.tertiary("The following commands are available through the ${(0,n.getAppTitle)(u,!0)} command-line interface:"));
|
|
11
|
+
writeLine(""); `),(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(t.For,{get each(){return h(l)},doubleHardline:!0,joiner:t.code`writeLine(""); `,ender:t.code`writeLine(""); `,children:r=>[(0,e.createIntrinsic)(`hbr`,{}),(0,e.memo)(()=>t.code`
|
|
12
|
+
writeLine(textColors.heading.primary(${r.icon?`(isUnicodeSupported ? " ${r.icon} " : "") + `:``}\`${r.title} ${r.isVirtual?``:`Command`}${r.tags?.length>0?` - ${r.tags.map(e=>`\${textColors.tags.${(0,c.camelCase)(e)} ? textColors.tags.${(0,c.camelCase)(e)}(inverse(" ${e} ")) : textColors.tags.$default(inverse(" ${e} "))}`).join(` `)}`:``}\`));
|
|
202
13
|
writeLine("");
|
|
203
|
-
writeLine(textColors.body.tertiary(splitText(\`${(0,
|
|
204
|
-
writeLine(""); `),
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
indent: 2,
|
|
209
|
-
filterGlobalOptions: true
|
|
210
|
-
}),
|
|
211
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
212
|
-
]
|
|
213
|
-
}),
|
|
214
|
-
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`help(\`Running a specific command with the help flag (via: \${inlineCode("${(0, _shell_shock_core_plugin_utils.getAppBin)(context)} ${segments && segments.length > 0 ? ` ${segments.join(" ")}` : ""} <specific command> --help")}) or the help command with the specific command as arguments (via: \${inlineCode("${(0, _shell_shock_core_plugin_utils.getAppBin)(context)} ${segments && segments.length > 0 ? ` ${segments.join(" ")}` : ""} help <specific command>")}) will provide additional information that is specific to that command.\`);
|
|
215
|
-
writeLine("");`)
|
|
216
|
-
];
|
|
217
|
-
}
|
|
218
|
-
})
|
|
219
|
-
];
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* A component that generates the invocation of the `help` function for a command.
|
|
223
|
-
*/
|
|
224
|
-
function CommandHelpDisplay(props) {
|
|
225
|
-
const { command } = props;
|
|
226
|
-
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
227
|
-
return [
|
|
228
|
-
_alloy_js_core.code`writeLine(""); `,
|
|
229
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
230
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(BaseHelpDisplay, {
|
|
231
|
-
command,
|
|
232
|
-
filterGlobalOptions: false
|
|
233
|
-
}),
|
|
234
|
-
_alloy_js_core.code`writeLine(""); `,
|
|
235
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
236
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
237
|
-
get when() {
|
|
238
|
-
return Object.keys(command.children).length > 0;
|
|
239
|
-
},
|
|
240
|
-
get children() {
|
|
241
|
-
return [
|
|
242
|
-
_alloy_js_core.code`writeLine(textColors.body.tertiary("The following sub-commands are available:"));
|
|
243
|
-
writeLine(""); `,
|
|
244
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
245
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
246
|
-
get each() {
|
|
247
|
-
return sortCommands(command.children);
|
|
248
|
-
},
|
|
249
|
-
doubleHardline: true,
|
|
250
|
-
joiner: _alloy_js_core.code`writeLine(""); `,
|
|
251
|
-
ender: _alloy_js_core.code`writeLine(""); `,
|
|
252
|
-
children: (child) => [
|
|
253
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
254
|
-
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`
|
|
255
|
-
writeLine(textColors.heading.primary(${child.icon ? `(isUnicodeSupported ? " ${child.icon} " : "") + ` : ""}\`${child.title} ${child.isVirtual ? "" : "Command"}${child.tags?.length > 0 ? ` - ${child.tags.map((tag) => `\${textColors.tags.${(0, _stryke_string_format_camel_case.camelCase)(tag)} ? textColors.tags.${(0, _stryke_string_format_camel_case.camelCase)(tag)}(inverse(" ${tag} ")) : textColors.tags.$default(inverse(" ${tag} "))}`).join(" ")}` : ""}\`));
|
|
14
|
+
writeLine(textColors.body.tertiary(splitText(\`${(0,n.formatDescription)(r.description).replace(/\.+$/,``).trim()}.\`)));
|
|
15
|
+
writeLine(""); `),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(m,{command:r,indent:2,filterGlobalOptions:!0}),(0,e.createIntrinsic)(`hbr`,{})]}),(0,e.memo)(()=>t.code`help(\`Running a specific command with the help flag (via: \${inlineCode("${(0,n.getAppBin)(u)} ${s&&s.length>0?` ${s.join(` `)}`:``} <specific command> --help")}) or the help command with the specific command as arguments (via: \${inlineCode("${(0,n.getAppBin)(u)} ${s&&s.length>0?` ${s.join(` `)}`:``} help <specific command>")}) will provide additional information that is specific to that command.\`);
|
|
16
|
+
writeLine("");`)]}})]}function _(r){let{command:o}=r,s=(0,a.usePowerlines)();return[t.code`writeLine(""); `,(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(m,{command:o,filterGlobalOptions:!1}),t.code`writeLine(""); `,(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(t.Show,{get when(){return Object.keys(o.children).length>0},get children(){return[t.code`writeLine(textColors.body.tertiary("The following sub-commands are available:"));
|
|
17
|
+
writeLine(""); `,(0,e.createComponent)(i.Spacing,{}),(0,e.createComponent)(t.For,{get each(){return h(o.children)},doubleHardline:!0,joiner:t.code`writeLine(""); `,ender:t.code`writeLine(""); `,children:r=>[(0,e.createIntrinsic)(`hbr`,{}),(0,e.memo)(()=>t.code`
|
|
18
|
+
writeLine(textColors.heading.primary(${r.icon?`(isUnicodeSupported ? " ${r.icon} " : "") + `:``}\`${r.title} ${r.isVirtual?``:`Command`}${r.tags?.length>0?` - ${r.tags.map(e=>`\${textColors.tags.${(0,c.camelCase)(e)} ? textColors.tags.${(0,c.camelCase)(e)}(inverse(" ${e} ")) : textColors.tags.$default(inverse(" ${e} "))}`).join(` `)}`:``}\`));
|
|
256
19
|
writeLine("");
|
|
257
|
-
writeLine(textColors.body.tertiary(splitText(\`${(0,
|
|
258
|
-
writeLine(""); `),
|
|
259
|
-
|
|
260
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(BaseHelpDisplay, {
|
|
261
|
-
command: child,
|
|
262
|
-
indent: 2,
|
|
263
|
-
filterGlobalOptions: true
|
|
264
|
-
}),
|
|
265
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
266
|
-
]
|
|
267
|
-
}),
|
|
268
|
-
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`help(\`Running a specific command with the help flag (via: \${inlineCode("${(0, _shell_shock_core_plugin_utils.getAppBin)(context)} ${command.segments.join(" ")} <specific command> --help")}) will provide additional information that is specific to that command.\`);
|
|
269
|
-
writeLine("");`)
|
|
270
|
-
];
|
|
271
|
-
}
|
|
272
|
-
})
|
|
273
|
-
];
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
//#endregion
|
|
277
|
-
exports.BaseHelpDisplay = BaseHelpDisplay;
|
|
278
|
-
exports.CommandHelpDisplay = CommandHelpDisplay;
|
|
279
|
-
exports.HelpCommandsDisplay = HelpCommandsDisplay;
|
|
280
|
-
exports.HelpOptionsDisplay = HelpOptionsDisplay;
|
|
281
|
-
exports.HelpUsageDisplay = HelpUsageDisplay;
|
|
282
|
-
exports.VirtualCommandHelpDisplay = VirtualCommandHelpDisplay;
|
|
20
|
+
writeLine(textColors.body.tertiary(splitText(\`${(0,n.formatDescription)(r.description).replace(/\.+$/,``).trim()}.\`)));
|
|
21
|
+
writeLine(""); `),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(m,{command:r,indent:2,filterGlobalOptions:!0}),(0,e.createIntrinsic)(`hbr`,{})]}),(0,e.memo)(()=>t.code`help(\`Running a specific command with the help flag (via: \${inlineCode("${(0,n.getAppBin)(s)} ${o.segments.join(` `)} <specific command> --help")}) will provide additional information that is specific to that command.\`);
|
|
22
|
+
writeLine("");`)]}})]}exports.BaseHelpDisplay=m,exports.CommandHelpDisplay=_,exports.HelpCommandsDisplay=p,exports.HelpOptionsDisplay=f,exports.HelpUsageDisplay=d,exports.VirtualCommandHelpDisplay=g;
|