@shell-shock/preset-script 0.2.0 → 0.3.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 +2 -2
- package/dist/components/args-parser-logic.d.cts +7 -7
- package/dist/components/args-parser-logic.d.cts.map +1 -1
- package/dist/components/bin-entry.cjs +0 -1
- package/dist/components/bin-entry.cjs.map +1 -1
- package/dist/components/bin-entry.d.cts.map +1 -1
- package/dist/components/bin-entry.d.mts.map +1 -1
- package/dist/components/bin-entry.mjs +0 -1
- package/dist/components/bin-entry.mjs.map +1 -1
- package/dist/components/command-entry.d.cts +4 -4
- package/dist/components/command-entry.d.mts +4 -4
- package/dist/components/command-entry.d.mts.map +1 -1
- package/dist/components/command-router.cjs +5 -7
- package/dist/components/command-router.cjs.map +1 -1
- package/dist/components/command-router.mjs +5 -7
- package/dist/components/command-router.mjs.map +1 -1
- package/dist/components/console-builtin.cjs +314 -82
- package/dist/components/console-builtin.cjs.map +1 -1
- package/dist/components/console-builtin.d.cts +12 -2
- package/dist/components/console-builtin.d.cts.map +1 -1
- package/dist/components/console-builtin.d.mts +12 -2
- package/dist/components/console-builtin.d.mts.map +1 -1
- package/dist/components/console-builtin.mjs +315 -84
- package/dist/components/console-builtin.mjs.map +1 -1
- package/dist/components/help.cjs +35 -23
- package/dist/components/help.cjs.map +1 -1
- package/dist/components/help.d.cts +19 -11
- package/dist/components/help.d.cts.map +1 -1
- package/dist/components/help.d.mts +19 -11
- package/dist/components/help.d.mts.map +1 -1
- package/dist/components/help.mjs +36 -24
- package/dist/components/help.mjs.map +1 -1
- package/dist/components/index.cjs +1 -0
- package/dist/components/index.d.cts +3 -3
- package/dist/components/index.d.mts +3 -3
- package/dist/components/index.mjs +2 -2
- package/dist/components/utils-builtin.cjs +18 -16
- package/dist/components/utils-builtin.cjs.map +1 -1
- package/dist/components/utils-builtin.d.cts +7 -7
- package/dist/components/utils-builtin.d.cts.map +1 -1
- package/dist/components/utils-builtin.d.mts +7 -7
- package/dist/components/utils-builtin.d.mts.map +1 -1
- package/dist/components/utils-builtin.mjs +18 -16
- package/dist/components/utils-builtin.mjs.map +1 -1
- package/dist/components/virtual-command-entry.d.cts +3 -3
- package/dist/components/virtual-command-entry.d.cts.map +1 -1
- package/dist/helpers/ansi-utils.cjs +74 -10
- package/dist/helpers/ansi-utils.cjs.map +1 -1
- package/dist/helpers/ansi-utils.mjs +74 -10
- package/dist/helpers/ansi-utils.mjs.map +1 -1
- package/dist/helpers/get-default-options.cjs +20 -0
- package/dist/helpers/get-default-options.cjs.map +1 -1
- package/dist/helpers/get-default-options.mjs +20 -0
- package/dist/helpers/get-default-options.mjs.map +1 -1
- package/dist/index.cjs +97 -75
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +99 -77
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/components/help.cjs
CHANGED
|
@@ -23,27 +23,26 @@ function HelpUsage(props) {
|
|
|
23
23
|
return Object.keys(context.config.bin);
|
|
24
24
|
},
|
|
25
25
|
hardline: true,
|
|
26
|
-
children: (bin) => __alloy_js_core.code`
|
|
26
|
+
children: (bin) => [(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`
|
|
27
27
|
writeLine(
|
|
28
28
|
colors.text.body.primary(
|
|
29
|
-
"$ ${bin} ${command.path.segments.map((segment) => (0, __shell_shock_core_plugin_utils_context_helpers.isVariableCommandPath)(segment) ? `<${command.path.variables[segment]?.variadic ? "..." : ""}${(0, __stryke_string_format_kebab_case.kebabCase)((0, __shell_shock_core_plugin_utils_context_helpers.getVariableCommandPathName)(segment))}>` : segment).join(" ")} [options]"
|
|
29
|
+
"$ npx ${bin} ${command.path.segments.map((segment) => (0, __shell_shock_core_plugin_utils_context_helpers.isVariableCommandPath)(segment) ? `<${command.path.variables[segment]?.variadic ? "..." : ""}${(0, __stryke_string_format_kebab_case.kebabCase)((0, __shell_shock_core_plugin_utils_context_helpers.getVariableCommandPathName)(segment))}>` : segment).join(" ")}${Object.values(command.children).length > 0 ? " [commands]" : ""} [options]"
|
|
30
30
|
), { padding: ${theme.padding.app * indent} }
|
|
31
|
-
);`
|
|
31
|
+
);`), (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})]
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* A component that generates the options table display for a command.
|
|
36
36
|
*/
|
|
37
37
|
function HelpOptions(props) {
|
|
38
|
-
const {
|
|
38
|
+
const { options } = props;
|
|
39
39
|
const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
40
40
|
return [
|
|
41
|
-
__alloy_js_core.code`table([
|
|
42
|
-
[{ value: colors.text.heading.tertiary("Name"), align: "right", border: { bottom: "secondary" } }, { value: colors.text.heading.tertiary("Description"), align: "left", border: { bottom: "secondary" } }], `,
|
|
41
|
+
__alloy_js_core.code`table([ `,
|
|
43
42
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
44
43
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
45
44
|
get each() {
|
|
46
|
-
return (0, __shell_shock_core_plugin_utils_reflect.sortOptions)(
|
|
45
|
+
return (0, __shell_shock_core_plugin_utils_reflect.sortOptions)(options);
|
|
47
46
|
},
|
|
48
47
|
hardline: true,
|
|
49
48
|
children: (option) => {
|
|
@@ -55,7 +54,7 @@ function HelpOptions(props) {
|
|
|
55
54
|
if (alias.length === 1) flags.push(`-${alias}`);
|
|
56
55
|
else names.push(`--${(0, __stryke_string_format_kebab_case.kebabCase)(alias)}`);
|
|
57
56
|
});
|
|
58
|
-
return __alloy_js_core.code`[{ value:
|
|
57
|
+
return __alloy_js_core.code`[{ value: colors.text.body.primary("${flags.length > 0 ? `${flags.sort().join(", ")}${names.length > 0 ? ", " : ""}` : ""}${names.length > 0 ? names.sort().join(", ") : ""}${option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string ? ` <${(0, __stryke_string_format_snake_case.snakeCase)(option.name)}${option.variadic ? "..." : ""}>` : option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? ` <${(0, __stryke_string_format_snake_case.snakeCase)(option.name)}${option.variadic ? "..." : ""}>` : ""}"), align: "right", border: "none" }, { value: colors.text.body.tertiary("${option.description.replace(/\.+$/, "")} ${option.env || option.default !== void 0 ? `(${option.env ? `env: ${context.config.envPrefix}_${option.env}${option.default !== void 0 ? ", " : ""}` : ""}${option.default !== void 0 ? `default: ${JSON.stringify(option.default)}` : ""})` : ""}."), align: "left", border: "none" }], `;
|
|
59
58
|
}
|
|
60
59
|
}),
|
|
61
60
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
@@ -66,17 +65,16 @@ function HelpOptions(props) {
|
|
|
66
65
|
* A component that generates the commands table display for a command.
|
|
67
66
|
*/
|
|
68
67
|
function HelpCommands(props) {
|
|
69
|
-
const {
|
|
68
|
+
const { commands } = props;
|
|
70
69
|
return [
|
|
71
|
-
__alloy_js_core.code`table([
|
|
72
|
-
[{ value: colors.text.heading.tertiary("Name"), align: "right", border: { bottom: "secondary" } }, { value: colors.text.heading.tertiary("Description"), align: "left", border: { bottom: "secondary" } }], `,
|
|
70
|
+
__alloy_js_core.code`table([ `,
|
|
73
71
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
74
72
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
75
73
|
get each() {
|
|
76
|
-
return Object.values(
|
|
74
|
+
return Object.values(commands);
|
|
77
75
|
},
|
|
78
76
|
hardline: true,
|
|
79
|
-
children: (child) => __alloy_js_core.code`[{ value:
|
|
77
|
+
children: (child) => __alloy_js_core.code`[{ value: colors.text.body.primary("${child.name}"), align: "right", border: "none" }, { value: colors.text.body.tertiary("${child.description.replace(/\.+$/, "")}"), align: "left", border: "none" }], `
|
|
80
78
|
}),
|
|
81
79
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
82
80
|
__alloy_js_core.code` ]); `
|
|
@@ -88,9 +86,10 @@ function HelpCommands(props) {
|
|
|
88
86
|
function Help(props) {
|
|
89
87
|
const { command, indent = 1 } = props;
|
|
90
88
|
const theme = require_contexts_theme.useTheme();
|
|
89
|
+
const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
90
|
+
const options = (0, __alloy_js_core.computed)(() => 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)))) ?? []);
|
|
91
91
|
return [
|
|
92
|
-
(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`writeLine("")
|
|
93
|
-
writeLine(colors.text.heading.secondary("USAGE:")${indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : ""});`),
|
|
92
|
+
(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`writeLine(colors.text.heading.secondary("Usage:")${indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : ""});`),
|
|
94
93
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
95
94
|
(0, __alloy_js_core_jsx_runtime.createComponent)(HelpUsage, {
|
|
96
95
|
command,
|
|
@@ -98,12 +97,23 @@ function Help(props) {
|
|
|
98
97
|
}),
|
|
99
98
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
100
99
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
101
|
-
(0, __alloy_js_core_jsx_runtime.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
100
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
101
|
+
get when() {
|
|
102
|
+
return options.value.length > 0;
|
|
103
|
+
},
|
|
104
|
+
get children() {
|
|
105
|
+
return [
|
|
106
|
+
(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`writeLine("");
|
|
107
|
+
writeLine(colors.text.heading.secondary("Options:")${indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : ""});`),
|
|
108
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
109
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(HelpOptions, { get options() {
|
|
110
|
+
return options.value;
|
|
111
|
+
} }),
|
|
112
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
113
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
114
|
+
];
|
|
115
|
+
}
|
|
116
|
+
}),
|
|
107
117
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
108
118
|
get when() {
|
|
109
119
|
return Object.keys(command.children).length > 0;
|
|
@@ -111,9 +121,11 @@ function Help(props) {
|
|
|
111
121
|
get children() {
|
|
112
122
|
return [
|
|
113
123
|
(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`writeLine("");
|
|
114
|
-
writeLine(colors.text.heading.secondary("
|
|
124
|
+
writeLine(colors.text.heading.secondary("Commands:")${indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : ""});`),
|
|
115
125
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
116
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(HelpCommands, {
|
|
126
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(HelpCommands, { get commands() {
|
|
127
|
+
return command.children;
|
|
128
|
+
} }),
|
|
117
129
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
118
130
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
119
131
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.cjs","names":["code","For","Show","ReflectionKind","usePowerlines","getVariableCommandPathName","isVariableCommandPath","sortOptions","kebabCase","snakeCase","useTheme","HelpUsage","props","command","indent","context","theme","_$createComponent","each","Object","keys","config","bin","hardline","children","path","segments","map","segment","variables","variadic","join","padding","app","HelpOptions","_$createIntrinsic","values","options","option","flags","names","name","length","push","alias","forEach","title","sort","kind","string","number","description","replace","env","default","undefined","envPrefix","JSON","stringify","HelpCommands","child","Help","_$memo","when"],"sources":["../../src/components/help.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, Show } from \"@alloy-js/core\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n getVariableCommandPathName,\n isVariableCommandPath\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport { sortOptions } from \"@shell-shock/core/plugin-utils/reflect\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\nimport { useTheme } from \"../contexts\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\n\nexport interface HelpUsageProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 2\n */\n indent?: number;\n}\n\n/**\n * A component that generates the usage display for a command.\n */\nexport function HelpUsage(props: HelpUsageProps) {\n const { command, indent = 2 } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const theme = useTheme();\n\n return (\n <For each={Object.keys(context.config.bin)} hardline>\n {bin =>\n code`\n writeLine(\n colors.text.body.primary(\n \"$ ${bin} ${command.path.segments\n .map(segment =>\n isVariableCommandPath(segment)\n ? `<${command.path.variables[segment]?.variadic ? \"...\" : \"\"}${kebabCase(\n getVariableCommandPathName(segment)\n )}>`\n : segment\n )\n .join(\" \")} [options]\"\n ), { padding: ${theme.padding.app * indent} }\n );`\n }\n </For>\n );\n}\n\n/**\n * A component that generates the options table display for a command.\n */\nexport function HelpOptions(props: { command: CommandTree }) {\n const { command } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n {code`table([\n [{ value: colors.text.heading.tertiary(\"Name\"), align: \"right\", border: { bottom: \"secondary\" } }, { value: colors.text.heading.tertiary(\"Description\"), align: \"left\", border: { bottom: \"secondary\" } }], `}\n <hbr />\n <For each={sortOptions(Object.values(command.options))} hardline>\n {option => {\n const flags = [] as string[];\n const names = [] as string[];\n if (option.name.length === 1) {\n flags.push(`-${option.name}`);\n } else {\n names.push(`--${kebabCase(option.name)}`);\n }\n\n option.alias.forEach((alias: string) => {\n if (alias.length === 1) {\n flags.push(`-${alias}`);\n } else {\n names.push(`--${kebabCase(alias)}`);\n }\n });\n\n return code`[{ value: \\`\\${colors.text.body.primary(\"${\n option.title\n }\")} \\${colors.text.body.secondary(\"${\n flags.length > 0\n ? `${flags.sort().join(\", \")}${names.length > 0 ? \", \" : \"\"}`\n : \"\"\n }${names.length > 0 ? names.sort().join(\", \") : \"\"}${\n option.kind === ReflectionKind.string\n ? ` <${snakeCase(option.name)}>${option.variadic ? \"...\" : \"\"}`\n : option.kind === ReflectionKind.number\n ? ` <${snakeCase(option.name)}>${option.variadic ? \"...\" : \"\"}`\n : \"\"\n }\")}\\`, align: \"right\" }, { value: colors.text.body.tertiary(\"${option.description.replace(\n /\\.+$/,\n \"\"\n )} ${\n option.env || option.default !== undefined\n ? `(${\n option.env\n ? `env: ${context.config.envPrefix}_${option.env}${\n option.default !== undefined ? \", \" : \"\"\n }`\n : \"\"\n }${\n option.default !== undefined\n ? `default: ${JSON.stringify(option.default)}`\n : \"\"\n })`\n : \"\"\n }.\"), align: \"left\" }], `;\n }}\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\n/**\n * A component that generates the commands table display for a command.\n */\nexport function HelpCommands(props: { command: CommandTree }) {\n const { command } = props;\n\n return (\n <>\n {code`table([\n [{ value: colors.text.heading.tertiary(\"Name\"), align: \"right\", border: { bottom: \"secondary\" } }, { value: colors.text.heading.tertiary(\"Description\"), align: \"left\", border: { bottom: \"secondary\" } }], `}\n <hbr />\n <For each={Object.values(command.children)} hardline>\n {child =>\n code`[{ value: \\`\\${colors.text.body.primary(\"${\n child.title\n }\")} \\${colors.text.body.secondary(\"(${\n child.name\n })\")}\\`, align: \"right\" }, { value: colors.text.body.tertiary(\"${child.description.replace(\n /\\.+$/,\n \"\"\n )}\"), align: \"left\" }], `\n }\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\nexport interface HelpProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 1\n */\n indent?: number;\n}\n\n/**\n * A component that generates the `help` function declaration for a command.\n */\nexport function Help(props: HelpProps) {\n const { command, indent = 1 } = props;\n\n const theme = useTheme();\n\n return (\n <>\n {code`writeLine(\"\");\n writeLine(colors.text.heading.secondary(\"USAGE:\")${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpUsage command={command} indent={indent} />\n <hbr />\n <hbr />\n {code`writeLine(\"\");\n writeLine(colors.text.heading.secondary(\"OPTIONS:\")${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpOptions command={command} />\n <hbr />\n <hbr />\n <Show when={Object.keys(command.children).length > 0}>\n {code`writeLine(\"\");\n writeLine(colors.text.heading.secondary(\"COMMANDS:\")${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpCommands command={command} />\n <hbr />\n <hbr />\n </Show>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAoDA,SAAgBW,UAAUC,OAAuB;CAC/C,MAAM,EAAEC,SAASC,SAAS,MAAMF;CAEhC,MAAMG,8EAA8C;CACpD,MAAMC,QAAQN,iCAAU;AAExB,yDACGT,qBAAG;EAAA,IAACiB,OAAI;AAAA,UAAEC,OAAOC,KAAKL,QAAQM,OAAOC,IAAI;;EAAEC,UAAQ;EAAAC,WACjDF,QACCtB,oBAAI;;;eAGGsB,IAAG,GAAIT,QAAQY,KAAKC,SACtBC,KAAIC,uFACmBA,QAAQ,GAC1B,IAAIf,QAAQY,KAAKI,UAAUD,UAAUE,WAAW,QAAQ,sIAC3BF,QAC7B,CAAC,CAAA,KACDA,QACL,CACAG,KAAK,IAAI,CAAA;wBACEf,MAAMgB,QAAQC,MAAMnB,OAAM;;EACzC,CAAA;;;;;AAST,SAAgBoB,YAAYtB,OAAiC;CAC3D,MAAM,EAAEC,YAAYD;CAEpB,MAAMG,8EAA8C;AAEpD,QAAA;EAEKf,oBAAI;;mDACwM,OAAA,EAAA,CAAA;mDAE5MC,qBAAG;GAAA,IAACiB,OAAI;AAAA,oEAAcC,OAAOiB,OAAOvB,QAAQwB,QAAQ,CAAC;;GAAEd,UAAQ;GAAAC,WAC7Dc,WAAU;IACT,MAAMC,QAAQ,EAAc;IAC5B,MAAMC,QAAQ,EAAc;AAC5B,QAAIF,OAAOG,KAAKC,WAAW,EACzBH,OAAMI,KAAK,IAAIL,OAAOG,OAAO;QAE7BD,OAAMG,KAAK,sDAAeL,OAAOG,KAAK,GAAG;AAG3CH,WAAOM,MAAMC,SAASD,UAAk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,OAAA,EAAA,CAAA;EAI5BpD,oBAAI;EAAO;;;;;AAyBlB,SAAgB6D,KAAKjD,OAAkB;CACrC,MAAM,EAAEC,SAASC,SAAS,MAAMF;CAEhC,MAAMI,QAAQN,iCAAU;AAExB,QAAA;8CAEKV,oBAAI;yDAEHc,SAAS,IAAI,gBAAgBE,MAAMgB,QAAQC,MAAMnB,OAAM,MAAO,GAAE,IAC9D;mDAAA,OAAA,EAAA,CAAA;mDAEHH,WAAS;GAAUE;GAAiBC;GAAM,CAAA;mDAAA,OAAA,EAAA,CAAA;mDAAA,OAAA,EAAA,CAAA;8CAG1Cd,oBAAI;2DAEHc,SAAS,IAAI,gBAAgBE,MAAMgB,QAAQC,MAAMnB,OAAM,MAAO,GAAE,IAC9D;mDAAA,OAAA,EAAA,CAAA;mDAEHoB,aAAW,EAAUrB,SAAO,CAAA;mDAAA,OAAA,EAAA,CAAA;mDAAA,OAAA,EAAA,CAAA;mDAG5BX,sBAAI;GAAA,IAAC6D,OAAI;AAAA,WAAE5C,OAAOC,KAAKP,QAAQW,SAAS,CAACkB,SAAS;;GAAC,IAAAlB,WAAA;AAAA,WAAA;iDACjDxB,oBAAI;4DAELc,SAAS,IAAI,gBAAgBE,MAAMgB,QAAQC,MAAMnB,OAAM,MAAO,GAAE,IAC9D;sDAAA,OAAA,EAAA,CAAA;sDAED6C,cAAY,EAAU9C,SAAO,CAAA;sDAAA,OAAA,EAAA,CAAA;sDAAA,OAAA,EAAA,CAAA;KAAA;;GAAA,CAAA;EAAA"}
|
|
1
|
+
{"version":3,"file":"help.cjs","names":["code","computed","For","Show","ReflectionKind","usePowerlines","getVariableCommandPathName","isVariableCommandPath","sortOptions","kebabCase","snakeCase","useTheme","HelpUsage","props","command","indent","context","theme","_$createComponent","each","Object","keys","config","bin","hardline","children","_$memo","path","segments","map","segment","variables","variadic","join","values","length","padding","app","_$createIntrinsic","HelpOptions","options","option","flags","names","name","push","alias","forEach","sort","kind","string","number","description","replace","env","default","undefined","envPrefix","JSON","stringify","HelpCommands","commands","child","Help","filter","some","globalOption","includes","when","value"],"sources":["../../src/components/help.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n getVariableCommandPathName,\n isVariableCommandPath\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport { sortOptions } from \"@shell-shock/core/plugin-utils/reflect\";\nimport type {\n CommandOption,\n CommandTree\n} from \"@shell-shock/core/types/command\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\nimport { useTheme } from \"../contexts\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\n\nexport interface HelpUsageProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 2\n */\n indent?: number;\n}\n\n/**\n * A component that generates the usage display for a command.\n */\nexport function HelpUsage(props: HelpUsageProps) {\n const { command, indent = 2 } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const theme = useTheme();\n\n return (\n <For each={Object.keys(context.config.bin)} hardline>\n {bin => (\n <>\n {code`\n writeLine(\n colors.text.body.primary(\n \"$ npx ${bin} ${command.path.segments\n .map(segment =>\n isVariableCommandPath(segment)\n ? `<${command.path.variables[segment]?.variadic ? \"...\" : \"\"}${kebabCase(\n getVariableCommandPathName(segment)\n )}>`\n : segment\n )\n .join(\" \")}${\n Object.values(command.children).length > 0 ? \" [commands]\" : \"\"\n } [options]\"\n ), { padding: ${theme.padding.app * indent} }\n );`}\n <hbr />\n </>\n )}\n </For>\n );\n}\n\nexport interface HelpOptionsProps {\n /**\n * The options to display help for.\n */\n options: CommandOption[];\n}\n\n/**\n * A component that generates the options table display for a command.\n */\nexport function HelpOptions(props: HelpOptionsProps) {\n const { options } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n {code`table([ `}\n <hbr />\n <For each={sortOptions(options)} hardline>\n {option => {\n const flags = [] as string[];\n const names = [] as string[];\n if (option.name.length === 1) {\n flags.push(`-${option.name}`);\n } else {\n names.push(`--${kebabCase(option.name)}`);\n }\n\n option.alias.forEach((alias: string) => {\n if (alias.length === 1) {\n flags.push(`-${alias}`);\n } else {\n names.push(`--${kebabCase(alias)}`);\n }\n });\n\n return code`[{ value: colors.text.body.primary(\"${\n flags.length > 0\n ? `${flags.sort().join(\", \")}${names.length > 0 ? \", \" : \"\"}`\n : \"\"\n }${names.length > 0 ? names.sort().join(\", \") : \"\"}${\n option.kind === ReflectionKind.string\n ? ` <${snakeCase(option.name)}${option.variadic ? \"...\" : \"\"}>`\n : option.kind === ReflectionKind.number\n ? ` <${snakeCase(option.name)}${option.variadic ? \"...\" : \"\"}>`\n : \"\"\n }\"), align: \"right\", border: \"none\" }, { value: colors.text.body.tertiary(\"${option.description.replace(\n /\\.+$/,\n \"\"\n )} ${\n option.env || option.default !== undefined\n ? `(${\n option.env\n ? `env: ${context.config.envPrefix}_${option.env}${\n option.default !== undefined ? \", \" : \"\"\n }`\n : \"\"\n }${\n option.default !== undefined\n ? `default: ${JSON.stringify(option.default)}`\n : \"\"\n })`\n : \"\"\n }.\"), align: \"left\", border: \"none\" }], `;\n }}\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\nexport interface HelpCommandsProps {\n /**\n * A mapping of command names to their command definitions.\n */\n commands: Record<string, CommandTree>;\n}\n\n/**\n * A component that generates the commands table display for a command.\n */\nexport function HelpCommands(props: HelpCommandsProps) {\n const { commands } = props;\n\n return (\n <>\n {code`table([ `}\n <hbr />\n <For each={Object.values(commands)} hardline>\n {child =>\n code`[{ value: colors.text.body.primary(\"${\n child.name\n }\"), align: \"right\", border: \"none\" }, { value: colors.text.body.tertiary(\"${child.description.replace(\n /\\.+$/,\n \"\"\n )}\"), align: \"left\", border: \"none\" }], `\n }\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\nexport interface HelpProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 1\n */\n indent?: number;\n}\n\n/**\n * A component that generates the `help` function declaration for a command.\n */\nexport function Help(props: HelpProps) {\n const { command, indent = 1 } = props;\n\n const theme = useTheme();\n const context = usePowerlines<ScriptPresetContext>();\n\n const options = computed(\n () =>\n Object.values(command.options).filter(\n option =>\n !context.options.some(\n globalOption =>\n globalOption.name === option.name ||\n option.alias.includes(globalOption.name) ||\n globalOption.alias?.includes(option.name) ||\n globalOption.alias?.some(alias => option.alias.includes(alias))\n )\n ) ?? []\n );\n\n return (\n <>\n {code`writeLine(colors.text.heading.secondary(\"Usage:\")${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpUsage command={command} indent={indent} />\n <hbr />\n <hbr />\n <Show when={options.value.length > 0}>\n {code`writeLine(\"\");\n writeLine(colors.text.heading.secondary(\"Options:\")${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpOptions options={options.value} />\n <hbr />\n <hbr />\n </Show>\n <Show when={Object.keys(command.children).length > 0}>\n {code`writeLine(\"\");\n writeLine(colors.text.heading.secondary(\"Commands:\")${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpCommands commands={command.children} />\n <hbr />\n <hbr />\n </Show>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAuDA,SAAgBY,UAAUC,OAAuB;CAC/C,MAAM,EAAEC,SAASC,SAAS,MAAMF;CAEhC,MAAMG,8EAA8C;CACpD,MAAMC,QAAQN,iCAAU;AAExB,yDACGT,qBAAG;EAAA,IAACiB,OAAI;AAAA,UAAEC,OAAOC,KAAKL,QAAQM,OAAOC,IAAI;;EAAEC,UAAQ;EAAAC,WACjDF,QAAG,6CAECvB,oBAAI;;;mBAGIuB,IAAG,GAAIT,QAAQa,KAAKC,SAC1BC,KAAIC,uFACmBA,QAAQ,GAC1B,IAAIhB,QAAQa,KAAKI,UAAUD,UAAUE,WAAW,QAAQ,sIAC3BF,QAC7B,CAAC,CAAA,KACDA,QACL,CACAG,KAAK,IAAI,GACVb,OAAOc,OAAOpB,QAAQW,SAAS,CAACU,SAAS,IAAI,gBAAgB,GAAE;wBAEnDlB,MAAMmB,QAAQC,MAAMtB,OAAM;UACzC,mDAAA,OAAA,EAAA,CAAA,CAAA;EAGF,CAAA;;;;;AAeP,SAAgBwB,YAAY1B,OAAyB;CACnD,MAAM,EAAE2B,YAAY3B;CAEpB,MAAMG,8EAA8C;AAEpD,QAAA;EAEKhB,oBAAI;mDAAU,OAAA,EAAA,CAAA;mDAEdE,qBAAG;GAAA,IAACiB,OAAI;AAAA,oEAAcqB,QAAQ;;GAAEhB,UAAQ;GAAAC,WACtCgB,WAAU;IACT,MAAMC,QAAQ,EAAc;IAC5B,MAAMC,QAAQ,EAAc;AAC5B,QAAIF,OAAOG,KAAKT,WAAW,EACzBO,OAAMG,KAAK,IAAIJ,OAAOG,OAAO;QAE7BD,OAAME,KAAK,sDAAeJ,OAAOG,KAAK,GAAG;AAG3CH,WAAOK,MAAMC,SAASD,UAAkB;AACtC,SAAIA,MAAMX,WAAW,EACnBO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A;sDAED6C,cAAY,EAAA,IAACC,WAAQ;AAAA,aAAE/C,QAAQW;QAAQ,CAAA;sDAAA,OAAA,EAAA,CAAA;sDAAA,OAAA,EAAA,CAAA;KAAA;;GAAA,CAAA;EAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { CommandTree } from "@shell-shock/core/types/command";
|
|
1
|
+
import * as _alloy_js_core7 from "@alloy-js/core";
|
|
2
|
+
import { CommandOption, CommandTree } from "@shell-shock/core/types/command";
|
|
3
3
|
|
|
4
4
|
//#region src/components/help.d.ts
|
|
5
5
|
interface HelpUsageProps {
|
|
@@ -20,19 +20,27 @@ interface HelpUsageProps {
|
|
|
20
20
|
/**
|
|
21
21
|
* A component that generates the usage display for a command.
|
|
22
22
|
*/
|
|
23
|
-
declare function HelpUsage(props: HelpUsageProps):
|
|
23
|
+
declare function HelpUsage(props: HelpUsageProps): _alloy_js_core7.Children;
|
|
24
|
+
interface HelpOptionsProps {
|
|
25
|
+
/**
|
|
26
|
+
* The options to display help for.
|
|
27
|
+
*/
|
|
28
|
+
options: CommandOption[];
|
|
29
|
+
}
|
|
24
30
|
/**
|
|
25
31
|
* A component that generates the options table display for a command.
|
|
26
32
|
*/
|
|
27
|
-
declare function HelpOptions(props:
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
declare function HelpOptions(props: HelpOptionsProps): _alloy_js_core7.Children;
|
|
34
|
+
interface HelpCommandsProps {
|
|
35
|
+
/**
|
|
36
|
+
* A mapping of command names to their command definitions.
|
|
37
|
+
*/
|
|
38
|
+
commands: Record<string, CommandTree>;
|
|
39
|
+
}
|
|
30
40
|
/**
|
|
31
41
|
* A component that generates the commands table display for a command.
|
|
32
42
|
*/
|
|
33
|
-
declare function HelpCommands(props:
|
|
34
|
-
command: CommandTree;
|
|
35
|
-
}): _alloy_js_core5.Children;
|
|
43
|
+
declare function HelpCommands(props: HelpCommandsProps): _alloy_js_core7.Children;
|
|
36
44
|
interface HelpProps {
|
|
37
45
|
/**
|
|
38
46
|
* The command to generate help for.
|
|
@@ -51,7 +59,7 @@ interface HelpProps {
|
|
|
51
59
|
/**
|
|
52
60
|
* A component that generates the `help` function declaration for a command.
|
|
53
61
|
*/
|
|
54
|
-
declare function Help(props: HelpProps):
|
|
62
|
+
declare function Help(props: HelpProps): _alloy_js_core7.Children;
|
|
55
63
|
//#endregion
|
|
56
|
-
export { Help, HelpCommands, HelpOptions, HelpProps, HelpUsage, HelpUsageProps };
|
|
64
|
+
export { Help, HelpCommands, HelpCommandsProps, HelpOptions, HelpOptionsProps, HelpProps, HelpUsage, HelpUsageProps };
|
|
57
65
|
//# sourceMappingURL=help.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.cts","names":[],"sources":["../../src/components/help.tsx"],"sourcesContent":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"help.d.cts","names":[],"sources":["../../src/components/help.tsx"],"sourcesContent":[],"mappings":";;;;UAmCiB,cAAA;;;AAAjB;EAoBgB,OAAA,EAhBL,WAgBc;EAiCR;AAUjB;AA+DA;AAUA;AAuBA;AAoBA;;;;;;;;iBA/JgB,SAAA,QAAiB,iBAAc,eAAA,CAAA;UAiC9B,gBAAA;;;;WAIN;;;;;iBAMK,WAAA,QAAmB,mBAAgB,eAAA,CAAA;UA+DlC,iBAAA;;;;YAIL,eAAe;;;;;iBAMX,YAAA,QAAoB,oBAAiB,eAAA,CAAA;UAuBpC,SAAA;;;;WAIN;;;;;;;;;;;;;;iBAgBK,IAAA,QAAY,YAAS,eAAA,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { CommandTree } from "@shell-shock/core/types/command";
|
|
1
|
+
import * as _alloy_js_core1 from "@alloy-js/core";
|
|
2
|
+
import { CommandOption, CommandTree } from "@shell-shock/core/types/command";
|
|
3
3
|
|
|
4
4
|
//#region src/components/help.d.ts
|
|
5
5
|
interface HelpUsageProps {
|
|
@@ -20,19 +20,27 @@ interface HelpUsageProps {
|
|
|
20
20
|
/**
|
|
21
21
|
* A component that generates the usage display for a command.
|
|
22
22
|
*/
|
|
23
|
-
declare function HelpUsage(props: HelpUsageProps):
|
|
23
|
+
declare function HelpUsage(props: HelpUsageProps): _alloy_js_core1.Children;
|
|
24
|
+
interface HelpOptionsProps {
|
|
25
|
+
/**
|
|
26
|
+
* The options to display help for.
|
|
27
|
+
*/
|
|
28
|
+
options: CommandOption[];
|
|
29
|
+
}
|
|
24
30
|
/**
|
|
25
31
|
* A component that generates the options table display for a command.
|
|
26
32
|
*/
|
|
27
|
-
declare function HelpOptions(props:
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
declare function HelpOptions(props: HelpOptionsProps): _alloy_js_core1.Children;
|
|
34
|
+
interface HelpCommandsProps {
|
|
35
|
+
/**
|
|
36
|
+
* A mapping of command names to their command definitions.
|
|
37
|
+
*/
|
|
38
|
+
commands: Record<string, CommandTree>;
|
|
39
|
+
}
|
|
30
40
|
/**
|
|
31
41
|
* A component that generates the commands table display for a command.
|
|
32
42
|
*/
|
|
33
|
-
declare function HelpCommands(props:
|
|
34
|
-
command: CommandTree;
|
|
35
|
-
}): _alloy_js_core7.Children;
|
|
43
|
+
declare function HelpCommands(props: HelpCommandsProps): _alloy_js_core1.Children;
|
|
36
44
|
interface HelpProps {
|
|
37
45
|
/**
|
|
38
46
|
* The command to generate help for.
|
|
@@ -51,7 +59,7 @@ interface HelpProps {
|
|
|
51
59
|
/**
|
|
52
60
|
* A component that generates the `help` function declaration for a command.
|
|
53
61
|
*/
|
|
54
|
-
declare function Help(props: HelpProps):
|
|
62
|
+
declare function Help(props: HelpProps): _alloy_js_core1.Children;
|
|
55
63
|
//#endregion
|
|
56
|
-
export { Help, HelpCommands, HelpOptions, HelpProps, HelpUsage, HelpUsageProps };
|
|
64
|
+
export { Help, HelpCommands, HelpCommandsProps, HelpOptions, HelpOptionsProps, HelpProps, HelpUsage, HelpUsageProps };
|
|
57
65
|
//# sourceMappingURL=help.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.mts","names":[],"sources":["../../src/components/help.tsx"],"sourcesContent":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"help.d.mts","names":[],"sources":["../../src/components/help.tsx"],"sourcesContent":[],"mappings":";;;;UAmCiB,cAAA;;;AAAjB;EAoBgB,OAAA,EAhBL,WAgBc;EAiCR;AAUjB;AA+DA;AAUA;AAuBA;AAoBA;;;;;;;;iBA/JgB,SAAA,QAAiB,iBAAc,eAAA,CAAA;UAiC9B,gBAAA;;;;WAIN;;;;;iBAMK,WAAA,QAAmB,mBAAgB,eAAA,CAAA;UA+DlC,iBAAA;;;;YAIL,eAAe;;;;;iBAMX,YAAA,QAAoB,oBAAiB,eAAA,CAAA;UAuBpC,SAAA;;;;WAIN;;;;;;;;;;;;;;iBAgBK,IAAA,QAAY,YAAS,eAAA,CAAA"}
|
package/dist/components/help.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useTheme } from "../contexts/theme.mjs";
|
|
2
2
|
import "../contexts/index.mjs";
|
|
3
3
|
import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
|
|
4
|
-
import { For, Show, code } from "@alloy-js/core";
|
|
4
|
+
import { For, Show, code, computed } from "@alloy-js/core";
|
|
5
5
|
import { getVariableCommandPathName, isVariableCommandPath } from "@shell-shock/core/plugin-utils/context-helpers";
|
|
6
6
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
7
7
|
import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
|
|
@@ -22,27 +22,26 @@ function HelpUsage(props) {
|
|
|
22
22
|
return Object.keys(context.config.bin);
|
|
23
23
|
},
|
|
24
24
|
hardline: true,
|
|
25
|
-
children: (bin) => code`
|
|
25
|
+
children: (bin) => [memo(() => code`
|
|
26
26
|
writeLine(
|
|
27
27
|
colors.text.body.primary(
|
|
28
|
-
"$ ${bin} ${command.path.segments.map((segment) => isVariableCommandPath(segment) ? `<${command.path.variables[segment]?.variadic ? "..." : ""}${kebabCase(getVariableCommandPathName(segment))}>` : segment).join(" ")} [options]"
|
|
28
|
+
"$ npx ${bin} ${command.path.segments.map((segment) => isVariableCommandPath(segment) ? `<${command.path.variables[segment]?.variadic ? "..." : ""}${kebabCase(getVariableCommandPathName(segment))}>` : segment).join(" ")}${Object.values(command.children).length > 0 ? " [commands]" : ""} [options]"
|
|
29
29
|
), { padding: ${theme.padding.app * indent} }
|
|
30
|
-
);`
|
|
30
|
+
);`), createIntrinsic("hbr", {})]
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* A component that generates the options table display for a command.
|
|
35
35
|
*/
|
|
36
36
|
function HelpOptions(props) {
|
|
37
|
-
const {
|
|
37
|
+
const { options } = props;
|
|
38
38
|
const context = usePowerlines();
|
|
39
39
|
return [
|
|
40
|
-
code`table([
|
|
41
|
-
[{ value: colors.text.heading.tertiary("Name"), align: "right", border: { bottom: "secondary" } }, { value: colors.text.heading.tertiary("Description"), align: "left", border: { bottom: "secondary" } }], `,
|
|
40
|
+
code`table([ `,
|
|
42
41
|
createIntrinsic("hbr", {}),
|
|
43
42
|
createComponent(For, {
|
|
44
43
|
get each() {
|
|
45
|
-
return sortOptions(
|
|
44
|
+
return sortOptions(options);
|
|
46
45
|
},
|
|
47
46
|
hardline: true,
|
|
48
47
|
children: (option) => {
|
|
@@ -54,7 +53,7 @@ function HelpOptions(props) {
|
|
|
54
53
|
if (alias.length === 1) flags.push(`-${alias}`);
|
|
55
54
|
else names.push(`--${kebabCase(alias)}`);
|
|
56
55
|
});
|
|
57
|
-
return code`[{ value:
|
|
56
|
+
return code`[{ value: colors.text.body.primary("${flags.length > 0 ? `${flags.sort().join(", ")}${names.length > 0 ? ", " : ""}` : ""}${names.length > 0 ? names.sort().join(", ") : ""}${option.kind === ReflectionKind.string ? ` <${snakeCase(option.name)}${option.variadic ? "..." : ""}>` : option.kind === ReflectionKind.number ? ` <${snakeCase(option.name)}${option.variadic ? "..." : ""}>` : ""}"), align: "right", border: "none" }, { value: colors.text.body.tertiary("${option.description.replace(/\.+$/, "")} ${option.env || option.default !== void 0 ? `(${option.env ? `env: ${context.config.envPrefix}_${option.env}${option.default !== void 0 ? ", " : ""}` : ""}${option.default !== void 0 ? `default: ${JSON.stringify(option.default)}` : ""})` : ""}."), align: "left", border: "none" }], `;
|
|
58
57
|
}
|
|
59
58
|
}),
|
|
60
59
|
createIntrinsic("hbr", {}),
|
|
@@ -65,17 +64,16 @@ function HelpOptions(props) {
|
|
|
65
64
|
* A component that generates the commands table display for a command.
|
|
66
65
|
*/
|
|
67
66
|
function HelpCommands(props) {
|
|
68
|
-
const {
|
|
67
|
+
const { commands } = props;
|
|
69
68
|
return [
|
|
70
|
-
code`table([
|
|
71
|
-
[{ value: colors.text.heading.tertiary("Name"), align: "right", border: { bottom: "secondary" } }, { value: colors.text.heading.tertiary("Description"), align: "left", border: { bottom: "secondary" } }], `,
|
|
69
|
+
code`table([ `,
|
|
72
70
|
createIntrinsic("hbr", {}),
|
|
73
71
|
createComponent(For, {
|
|
74
72
|
get each() {
|
|
75
|
-
return Object.values(
|
|
73
|
+
return Object.values(commands);
|
|
76
74
|
},
|
|
77
75
|
hardline: true,
|
|
78
|
-
children: (child) => code`[{ value:
|
|
76
|
+
children: (child) => code`[{ value: colors.text.body.primary("${child.name}"), align: "right", border: "none" }, { value: colors.text.body.tertiary("${child.description.replace(/\.+$/, "")}"), align: "left", border: "none" }], `
|
|
79
77
|
}),
|
|
80
78
|
createIntrinsic("hbr", {}),
|
|
81
79
|
code` ]); `
|
|
@@ -87,9 +85,10 @@ function HelpCommands(props) {
|
|
|
87
85
|
function Help(props) {
|
|
88
86
|
const { command, indent = 1 } = props;
|
|
89
87
|
const theme = useTheme();
|
|
88
|
+
const context = usePowerlines();
|
|
89
|
+
const options = computed(() => 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)))) ?? []);
|
|
90
90
|
return [
|
|
91
|
-
memo(() => code`writeLine("")
|
|
92
|
-
writeLine(colors.text.heading.secondary("USAGE:")${indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : ""});`),
|
|
91
|
+
memo(() => code`writeLine(colors.text.heading.secondary("Usage:")${indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : ""});`),
|
|
93
92
|
createIntrinsic("hbr", {}),
|
|
94
93
|
createComponent(HelpUsage, {
|
|
95
94
|
command,
|
|
@@ -97,12 +96,23 @@ function Help(props) {
|
|
|
97
96
|
}),
|
|
98
97
|
createIntrinsic("hbr", {}),
|
|
99
98
|
createIntrinsic("hbr", {}),
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
99
|
+
createComponent(Show, {
|
|
100
|
+
get when() {
|
|
101
|
+
return options.value.length > 0;
|
|
102
|
+
},
|
|
103
|
+
get children() {
|
|
104
|
+
return [
|
|
105
|
+
memo(() => code`writeLine("");
|
|
106
|
+
writeLine(colors.text.heading.secondary("Options:")${indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : ""});`),
|
|
107
|
+
createIntrinsic("hbr", {}),
|
|
108
|
+
createComponent(HelpOptions, { get options() {
|
|
109
|
+
return options.value;
|
|
110
|
+
} }),
|
|
111
|
+
createIntrinsic("hbr", {}),
|
|
112
|
+
createIntrinsic("hbr", {})
|
|
113
|
+
];
|
|
114
|
+
}
|
|
115
|
+
}),
|
|
106
116
|
createComponent(Show, {
|
|
107
117
|
get when() {
|
|
108
118
|
return Object.keys(command.children).length > 0;
|
|
@@ -110,9 +120,11 @@ function Help(props) {
|
|
|
110
120
|
get children() {
|
|
111
121
|
return [
|
|
112
122
|
memo(() => code`writeLine("");
|
|
113
|
-
writeLine(colors.text.heading.secondary("
|
|
123
|
+
writeLine(colors.text.heading.secondary("Commands:")${indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : ""});`),
|
|
114
124
|
createIntrinsic("hbr", {}),
|
|
115
|
-
createComponent(HelpCommands, {
|
|
125
|
+
createComponent(HelpCommands, { get commands() {
|
|
126
|
+
return command.children;
|
|
127
|
+
} }),
|
|
116
128
|
createIntrinsic("hbr", {}),
|
|
117
129
|
createIntrinsic("hbr", {})
|
|
118
130
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.mjs","names":["code","For","Show","ReflectionKind","usePowerlines","getVariableCommandPathName","isVariableCommandPath","sortOptions","kebabCase","snakeCase","useTheme","HelpUsage","props","command","indent","context","theme","_$createComponent","each","Object","keys","config","bin","hardline","children","path","segments","map","segment","variables","variadic","join","padding","app","HelpOptions","_$createIntrinsic","values","options","option","flags","names","name","length","push","alias","forEach","title","sort","kind","string","number","description","replace","env","default","undefined","envPrefix","JSON","stringify","HelpCommands","child","Help","_$memo","when"],"sources":["../../src/components/help.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, Show } from \"@alloy-js/core\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n getVariableCommandPathName,\n isVariableCommandPath\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport { sortOptions } from \"@shell-shock/core/plugin-utils/reflect\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\nimport { useTheme } from \"../contexts\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\n\nexport interface HelpUsageProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 2\n */\n indent?: number;\n}\n\n/**\n * A component that generates the usage display for a command.\n */\nexport function HelpUsage(props: HelpUsageProps) {\n const { command, indent = 2 } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const theme = useTheme();\n\n return (\n <For each={Object.keys(context.config.bin)} hardline>\n {bin =>\n code`\n writeLine(\n colors.text.body.primary(\n \"$ ${bin} ${command.path.segments\n .map(segment =>\n isVariableCommandPath(segment)\n ? `<${command.path.variables[segment]?.variadic ? \"...\" : \"\"}${kebabCase(\n getVariableCommandPathName(segment)\n )}>`\n : segment\n )\n .join(\" \")} [options]\"\n ), { padding: ${theme.padding.app * indent} }\n );`\n }\n </For>\n );\n}\n\n/**\n * A component that generates the options table display for a command.\n */\nexport function HelpOptions(props: { command: CommandTree }) {\n const { command } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n {code`table([\n [{ value: colors.text.heading.tertiary(\"Name\"), align: \"right\", border: { bottom: \"secondary\" } }, { value: colors.text.heading.tertiary(\"Description\"), align: \"left\", border: { bottom: \"secondary\" } }], `}\n <hbr />\n <For each={sortOptions(Object.values(command.options))} hardline>\n {option => {\n const flags = [] as string[];\n const names = [] as string[];\n if (option.name.length === 1) {\n flags.push(`-${option.name}`);\n } else {\n names.push(`--${kebabCase(option.name)}`);\n }\n\n option.alias.forEach((alias: string) => {\n if (alias.length === 1) {\n flags.push(`-${alias}`);\n } else {\n names.push(`--${kebabCase(alias)}`);\n }\n });\n\n return code`[{ value: \\`\\${colors.text.body.primary(\"${\n option.title\n }\")} \\${colors.text.body.secondary(\"${\n flags.length > 0\n ? `${flags.sort().join(\", \")}${names.length > 0 ? \", \" : \"\"}`\n : \"\"\n }${names.length > 0 ? names.sort().join(\", \") : \"\"}${\n option.kind === ReflectionKind.string\n ? ` <${snakeCase(option.name)}>${option.variadic ? \"...\" : \"\"}`\n : option.kind === ReflectionKind.number\n ? ` <${snakeCase(option.name)}>${option.variadic ? \"...\" : \"\"}`\n : \"\"\n }\")}\\`, align: \"right\" }, { value: colors.text.body.tertiary(\"${option.description.replace(\n /\\.+$/,\n \"\"\n )} ${\n option.env || option.default !== undefined\n ? `(${\n option.env\n ? `env: ${context.config.envPrefix}_${option.env}${\n option.default !== undefined ? \", \" : \"\"\n }`\n : \"\"\n }${\n option.default !== undefined\n ? `default: ${JSON.stringify(option.default)}`\n : \"\"\n })`\n : \"\"\n }.\"), align: \"left\" }], `;\n }}\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\n/**\n * A component that generates the commands table display for a command.\n */\nexport function HelpCommands(props: { command: CommandTree }) {\n const { command } = props;\n\n return (\n <>\n {code`table([\n [{ value: colors.text.heading.tertiary(\"Name\"), align: \"right\", border: { bottom: \"secondary\" } }, { value: colors.text.heading.tertiary(\"Description\"), align: \"left\", border: { bottom: \"secondary\" } }], `}\n <hbr />\n <For each={Object.values(command.children)} hardline>\n {child =>\n code`[{ value: \\`\\${colors.text.body.primary(\"${\n child.title\n }\")} \\${colors.text.body.secondary(\"(${\n child.name\n })\")}\\`, align: \"right\" }, { value: colors.text.body.tertiary(\"${child.description.replace(\n /\\.+$/,\n \"\"\n )}\"), align: \"left\" }], `\n }\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\nexport interface HelpProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 1\n */\n indent?: number;\n}\n\n/**\n * A component that generates the `help` function declaration for a command.\n */\nexport function Help(props: HelpProps) {\n const { command, indent = 1 } = props;\n\n const theme = useTheme();\n\n return (\n <>\n {code`writeLine(\"\");\n writeLine(colors.text.heading.secondary(\"USAGE:\")${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpUsage command={command} indent={indent} />\n <hbr />\n <hbr />\n {code`writeLine(\"\");\n writeLine(colors.text.heading.secondary(\"OPTIONS:\")${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpOptions command={command} />\n <hbr />\n <hbr />\n <Show when={Object.keys(command.children).length > 0}>\n {code`writeLine(\"\");\n writeLine(colors.text.heading.secondary(\"COMMANDS:\")${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpCommands command={command} />\n <hbr />\n <hbr />\n </Show>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoDA,SAAgBW,UAAUC,OAAuB;CAC/C,MAAM,EAAEC,SAASC,SAAS,MAAMF;CAEhC,MAAMG,UAAUX,eAAoC;CACpD,MAAMY,QAAQN,UAAU;AAExB,QAAAO,gBACGhB,KAAG;EAAA,IAACiB,OAAI;AAAA,UAAEC,OAAOC,KAAKL,QAAQM,OAAOC,IAAI;;EAAEC,UAAQ;EAAAC,WACjDF,QACCtB,IAAI;;;eAGGsB,IAAG,GAAIT,QAAQY,KAAKC,SACtBC,KAAIC,YACHtB,sBAAsBsB,QAAQ,GAC1B,IAAIf,QAAQY,KAAKI,UAAUD,UAAUE,WAAW,QAAQ,KAAKtB,UAC3DH,2BAA2BuB,QAC7B,CAAC,CAAA,KACDA,QACL,CACAG,KAAK,IAAI,CAAA;wBACEf,MAAMgB,QAAQC,MAAMnB,OAAM;;EACzC,CAAA;;;;;AAST,SAAgBoB,YAAYtB,OAAiC;CAC3D,MAAM,EAAEC,YAAYD;CAEpB,MAAMG,UAAUX,eAAoC;AAEpD,QAAA;EAEKJ,IAAI;;EACwMmC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KAAAsC,WACjD9D,IAAI;4DAELc,SAAS,IAAI,gBAAgBE,MAAMgB,QAAQC,MAAMnB,OAAM,MAAO,GAAE,IAC9D;KAAAqB,gBAAA,OAAA,EAAA,CAAA;KAAAlB,gBAED0C,cAAY,EAAU9C,SAAO,CAAA;KAAAsB,gBAAA,OAAA,EAAA,CAAA;KAAAA,gBAAA,OAAA,EAAA,CAAA;KAAA;;GAAA,CAAA;EAAA"}
|
|
1
|
+
{"version":3,"file":"help.mjs","names":["code","computed","For","Show","ReflectionKind","usePowerlines","getVariableCommandPathName","isVariableCommandPath","sortOptions","kebabCase","snakeCase","useTheme","HelpUsage","props","command","indent","context","theme","_$createComponent","each","Object","keys","config","bin","hardline","children","_$memo","path","segments","map","segment","variables","variadic","join","values","length","padding","app","_$createIntrinsic","HelpOptions","options","option","flags","names","name","push","alias","forEach","sort","kind","string","number","description","replace","env","default","undefined","envPrefix","JSON","stringify","HelpCommands","commands","child","Help","filter","some","globalOption","includes","when","value"],"sources":["../../src/components/help.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n getVariableCommandPathName,\n isVariableCommandPath\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport { sortOptions } from \"@shell-shock/core/plugin-utils/reflect\";\nimport type {\n CommandOption,\n CommandTree\n} from \"@shell-shock/core/types/command\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\nimport { useTheme } from \"../contexts\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\n\nexport interface HelpUsageProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 2\n */\n indent?: number;\n}\n\n/**\n * A component that generates the usage display for a command.\n */\nexport function HelpUsage(props: HelpUsageProps) {\n const { command, indent = 2 } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const theme = useTheme();\n\n return (\n <For each={Object.keys(context.config.bin)} hardline>\n {bin => (\n <>\n {code`\n writeLine(\n colors.text.body.primary(\n \"$ npx ${bin} ${command.path.segments\n .map(segment =>\n isVariableCommandPath(segment)\n ? `<${command.path.variables[segment]?.variadic ? \"...\" : \"\"}${kebabCase(\n getVariableCommandPathName(segment)\n )}>`\n : segment\n )\n .join(\" \")}${\n Object.values(command.children).length > 0 ? \" [commands]\" : \"\"\n } [options]\"\n ), { padding: ${theme.padding.app * indent} }\n );`}\n <hbr />\n </>\n )}\n </For>\n );\n}\n\nexport interface HelpOptionsProps {\n /**\n * The options to display help for.\n */\n options: CommandOption[];\n}\n\n/**\n * A component that generates the options table display for a command.\n */\nexport function HelpOptions(props: HelpOptionsProps) {\n const { options } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n {code`table([ `}\n <hbr />\n <For each={sortOptions(options)} hardline>\n {option => {\n const flags = [] as string[];\n const names = [] as string[];\n if (option.name.length === 1) {\n flags.push(`-${option.name}`);\n } else {\n names.push(`--${kebabCase(option.name)}`);\n }\n\n option.alias.forEach((alias: string) => {\n if (alias.length === 1) {\n flags.push(`-${alias}`);\n } else {\n names.push(`--${kebabCase(alias)}`);\n }\n });\n\n return code`[{ value: colors.text.body.primary(\"${\n flags.length > 0\n ? `${flags.sort().join(\", \")}${names.length > 0 ? \", \" : \"\"}`\n : \"\"\n }${names.length > 0 ? names.sort().join(\", \") : \"\"}${\n option.kind === ReflectionKind.string\n ? ` <${snakeCase(option.name)}${option.variadic ? \"...\" : \"\"}>`\n : option.kind === ReflectionKind.number\n ? ` <${snakeCase(option.name)}${option.variadic ? \"...\" : \"\"}>`\n : \"\"\n }\"), align: \"right\", border: \"none\" }, { value: colors.text.body.tertiary(\"${option.description.replace(\n /\\.+$/,\n \"\"\n )} ${\n option.env || option.default !== undefined\n ? `(${\n option.env\n ? `env: ${context.config.envPrefix}_${option.env}${\n option.default !== undefined ? \", \" : \"\"\n }`\n : \"\"\n }${\n option.default !== undefined\n ? `default: ${JSON.stringify(option.default)}`\n : \"\"\n })`\n : \"\"\n }.\"), align: \"left\", border: \"none\" }], `;\n }}\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\nexport interface HelpCommandsProps {\n /**\n * A mapping of command names to their command definitions.\n */\n commands: Record<string, CommandTree>;\n}\n\n/**\n * A component that generates the commands table display for a command.\n */\nexport function HelpCommands(props: HelpCommandsProps) {\n const { commands } = props;\n\n return (\n <>\n {code`table([ `}\n <hbr />\n <For each={Object.values(commands)} hardline>\n {child =>\n code`[{ value: colors.text.body.primary(\"${\n child.name\n }\"), align: \"right\", border: \"none\" }, { value: colors.text.body.tertiary(\"${child.description.replace(\n /\\.+$/,\n \"\"\n )}\"), align: \"left\", border: \"none\" }], `\n }\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\nexport interface HelpProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 1\n */\n indent?: number;\n}\n\n/**\n * A component that generates the `help` function declaration for a command.\n */\nexport function Help(props: HelpProps) {\n const { command, indent = 1 } = props;\n\n const theme = useTheme();\n const context = usePowerlines<ScriptPresetContext>();\n\n const options = computed(\n () =>\n Object.values(command.options).filter(\n option =>\n !context.options.some(\n globalOption =>\n globalOption.name === option.name ||\n option.alias.includes(globalOption.name) ||\n globalOption.alias?.includes(option.name) ||\n globalOption.alias?.some(alias => option.alias.includes(alias))\n )\n ) ?? []\n );\n\n return (\n <>\n {code`writeLine(colors.text.heading.secondary(\"Usage:\")${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpUsage command={command} indent={indent} />\n <hbr />\n <hbr />\n <Show when={options.value.length > 0}>\n {code`writeLine(\"\");\n writeLine(colors.text.heading.secondary(\"Options:\")${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpOptions options={options.value} />\n <hbr />\n <hbr />\n </Show>\n <Show when={Object.keys(command.children).length > 0}>\n {code`writeLine(\"\");\n writeLine(colors.text.heading.secondary(\"Commands:\")${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpCommands commands={command.children} />\n <hbr />\n <hbr />\n </Show>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAuDA,SAAgBY,UAAUC,OAAuB;CAC/C,MAAM,EAAEC,SAASC,SAAS,MAAMF;CAEhC,MAAMG,UAAUX,eAAoC;CACpD,MAAMY,QAAQN,UAAU;AAExB,QAAAO,gBACGhB,KAAG;EAAA,IAACiB,OAAI;AAAA,UAAEC,OAAOC,KAAKL,QAAQM,OAAOC,IAAI;;EAAEC,UAAQ;EAAAC,WACjDF,QAAG,CAAAG,WAEC1B,IAAI;;;mBAGIuB,IAAG,GAAIT,QAAQa,KAAKC,SAC1BC,KAAIC,YACHvB,sBAAsBuB,QAAQ,GAC1B,IAAIhB,QAAQa,KAAKI,UAAUD,UAAUE,WAAW,QAAQ,KAAKvB,UAC3DH,2BAA2BwB,QAC7B,CAAC,CAAA,KACDA,QACL,CACAG,KAAK,IAAI,GACVb,OAAOc,OAAOpB,QAAQW,SAAS,CA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,OAAA,EAAA,CAAA;EAAApB,gBAEHN,WAAS;GAAUE;GAAiBC;GAAM,CAAA;EAAAuB,gBAAA,OAAA,EAAA,CAAA;EAAAA,gBAAA,OAAA,EAAA,CAAA;EAAApB,gBAG1Cf,MAAI;GAAA,IAACiE,OAAI;AAAA,WAAE5B,QAAQ6B,MAAMlC,SAAS;;GAAC,IAAAV,WAAA;AAAA,WAAA;KAAAC,WACjC1B,IAAI;2DAELe,SAAS,IAAI,gBAAgBE,MAAMmB,QAAQC,MAAMtB,OAAM,MAAO,GAAE,IAC9D;KAAAuB,gBAAA,OAAA,EAAA,CAAA;KAAApB,gBAEDqB,aAAW,EAAA,IAACC,UAAO;AAAA,aAAEA,QAAQ6B;QAAK,CAAA;KAAA/B,gBAAA,OAAA,EAAA,CAAA;KAAAA,gBAAA,OAAA,EAAA,CAAA;KAAA;;GAAA,CAAA;EAAApB,gBAIpCf,MAAI;GAAA,IAACiE,OAAI;AAAA,WAAEhD,OAAOC,KAAKP,QAAQW,SAAS,CAACU,SAAS;;GAAC,IAAAV,WAAA;AAAA,WAAA;KAAAC,WACjD1B,IAAI;4DAELe,SAAS,IAAI,gBAAgBE,MAAMmB,QAAQC,MAAMtB,OAAM,MAAO,GAAE,IAC9D;KAAAuB,gBAAA,OAAA,EAAA,CAAA;KAAApB,gBAED0C,cAAY,EAAA,IAACC,WAAQ;AAAA,aAAE/C,QAAQW;QAAQ,CAAA;KAAAa,gBAAA,OAAA,EAAA,CAAA;KAAAA,gBAAA,OAAA,EAAA,CAAA;KAAA;;GAAA,CAAA;EAAA"}
|
|
@@ -8,6 +8,7 @@ const require_components_console_builtin = require('./console-builtin.cjs');
|
|
|
8
8
|
const require_components_utils_builtin = require('./utils-builtin.cjs');
|
|
9
9
|
|
|
10
10
|
exports.ArgsUtilities = require_components_utils_builtin.ArgsUtilities;
|
|
11
|
+
exports.BannerFunctionDeclaration = require_components_console_builtin.BannerFunctionDeclaration;
|
|
11
12
|
exports.BinEntry = require_components_bin_entry.BinEntry;
|
|
12
13
|
exports.ColorSupportUtilities = require_components_utils_builtin.ColorSupportUtilities;
|
|
13
14
|
exports.ColorsDeclaration = require_components_console_builtin.ColorsDeclaration;
|
|
@@ -2,8 +2,8 @@ import { OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserLogic, O
|
|
|
2
2
|
import { BinEntry, BinEntryProps, RunApplication } from "./bin-entry.cjs";
|
|
3
3
|
import { CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandInvocation } from "./command-entry.cjs";
|
|
4
4
|
import { CommandRouter, CommandRouterProps, CommandRouterRoute } from "./command-router.cjs";
|
|
5
|
-
import { ColorsDeclaration, ConsoleBuiltin, DividerFunctionDeclaration, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, WrapAnsiFunction, WriteLineFunctionDeclaration } from "./console-builtin.cjs";
|
|
6
|
-
import { Help, HelpCommands, HelpOptions, HelpProps, HelpUsage, HelpUsageProps } from "./help.cjs";
|
|
5
|
+
import { BannerFunctionDeclaration, BannerFunctionDeclarationProps, ColorsDeclaration, ConsoleBuiltin, DividerFunctionDeclaration, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, WrapAnsiFunction, WriteLineFunctionDeclaration } from "./console-builtin.cjs";
|
|
6
|
+
import { Help, HelpCommands, HelpCommandsProps, HelpOptions, HelpOptionsProps, HelpProps, HelpUsage, HelpUsageProps } from "./help.cjs";
|
|
7
7
|
import { ArgsUtilities, ColorSupportUtilities, EnvSupportUtilities, ExitFunctionDeclaration, HyperlinkSupportUtilities, UtilsBuiltin, UtilsBuiltinProps } from "./utils-builtin.cjs";
|
|
8
8
|
import { VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration } from "./virtual-command-entry.cjs";
|
|
9
|
-
export { ArgsUtilities, BinEntry, BinEntryProps, ColorSupportUtilities, ColorsDeclaration, CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandInvocation, CommandRouter, CommandRouterProps, CommandRouterRoute, ConsoleBuiltin, DividerFunctionDeclaration, EnvSupportUtilities, ExitFunctionDeclaration, Help, HelpCommands, HelpOptions, HelpProps, HelpUsage, HelpUsageProps, HyperlinkSupportUtilities, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserLogic, OptionsParserLogic, ParamsParserLogic, RunApplication, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, UtilsBuiltin, UtilsBuiltinProps, VariablePathsParserLogic, VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration, WrapAnsiFunction, WriteLineFunctionDeclaration };
|
|
9
|
+
export { ArgsUtilities, BannerFunctionDeclaration, BannerFunctionDeclarationProps, BinEntry, BinEntryProps, ColorSupportUtilities, ColorsDeclaration, CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandInvocation, CommandRouter, CommandRouterProps, CommandRouterRoute, ConsoleBuiltin, DividerFunctionDeclaration, EnvSupportUtilities, ExitFunctionDeclaration, Help, HelpCommands, HelpCommandsProps, HelpOptions, HelpOptionsProps, HelpProps, HelpUsage, HelpUsageProps, HyperlinkSupportUtilities, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserLogic, OptionsParserLogic, ParamsParserLogic, RunApplication, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, UtilsBuiltin, UtilsBuiltinProps, VariablePathsParserLogic, VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration, WrapAnsiFunction, WriteLineFunctionDeclaration };
|
|
@@ -2,8 +2,8 @@ import { OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserLogic, O
|
|
|
2
2
|
import { BinEntry, BinEntryProps, RunApplication } from "./bin-entry.mjs";
|
|
3
3
|
import { CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandInvocation } from "./command-entry.mjs";
|
|
4
4
|
import { CommandRouter, CommandRouterProps, CommandRouterRoute } from "./command-router.mjs";
|
|
5
|
-
import { ColorsDeclaration, ConsoleBuiltin, DividerFunctionDeclaration, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, WrapAnsiFunction, WriteLineFunctionDeclaration } from "./console-builtin.mjs";
|
|
6
|
-
import { Help, HelpCommands, HelpOptions, HelpProps, HelpUsage, HelpUsageProps } from "./help.mjs";
|
|
5
|
+
import { BannerFunctionDeclaration, BannerFunctionDeclarationProps, ColorsDeclaration, ConsoleBuiltin, DividerFunctionDeclaration, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, WrapAnsiFunction, WriteLineFunctionDeclaration } from "./console-builtin.mjs";
|
|
6
|
+
import { Help, HelpCommands, HelpCommandsProps, HelpOptions, HelpOptionsProps, HelpProps, HelpUsage, HelpUsageProps } from "./help.mjs";
|
|
7
7
|
import { ArgsUtilities, ColorSupportUtilities, EnvSupportUtilities, ExitFunctionDeclaration, HyperlinkSupportUtilities, UtilsBuiltin, UtilsBuiltinProps } from "./utils-builtin.mjs";
|
|
8
8
|
import { VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration } from "./virtual-command-entry.mjs";
|
|
9
|
-
export { ArgsUtilities, BinEntry, BinEntryProps, ColorSupportUtilities, ColorsDeclaration, CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandInvocation, CommandRouter, CommandRouterProps, CommandRouterRoute, ConsoleBuiltin, DividerFunctionDeclaration, EnvSupportUtilities, ExitFunctionDeclaration, Help, HelpCommands, HelpOptions, HelpProps, HelpUsage, HelpUsageProps, HyperlinkSupportUtilities, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserLogic, OptionsParserLogic, ParamsParserLogic, RunApplication, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, UtilsBuiltin, UtilsBuiltinProps, VariablePathsParserLogic, VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration, WrapAnsiFunction, WriteLineFunctionDeclaration };
|
|
9
|
+
export { ArgsUtilities, BannerFunctionDeclaration, BannerFunctionDeclarationProps, BinEntry, BinEntryProps, ColorSupportUtilities, ColorsDeclaration, CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandInvocation, CommandRouter, CommandRouterProps, CommandRouterRoute, ConsoleBuiltin, DividerFunctionDeclaration, EnvSupportUtilities, ExitFunctionDeclaration, Help, HelpCommands, HelpCommandsProps, HelpOptions, HelpOptionsProps, HelpProps, HelpUsage, HelpUsageProps, HyperlinkSupportUtilities, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserLogic, OptionsParserLogic, ParamsParserLogic, RunApplication, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, UtilsBuiltin, UtilsBuiltinProps, VariablePathsParserLogic, VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration, WrapAnsiFunction, WriteLineFunctionDeclaration };
|
|
@@ -4,7 +4,7 @@ import { Help, HelpCommands, HelpOptions, HelpUsage } from "./help.mjs";
|
|
|
4
4
|
import { CommandRouter, CommandRouterRoute } from "./command-router.mjs";
|
|
5
5
|
import { VirtualCommandEntry, VirtualCommandHandlerDeclaration } from "./virtual-command-entry.mjs";
|
|
6
6
|
import { CommandEntry, CommandHandlerDeclaration, CommandInvocation } from "./command-entry.mjs";
|
|
7
|
-
import { ColorsDeclaration, ConsoleBuiltin, DividerFunctionDeclaration, LinkFunctionDeclaration, MessageFunctionDeclaration, StripAnsiFunctionDeclaration, TableFunctionDeclaration, WrapAnsiFunction, WriteLineFunctionDeclaration } from "./console-builtin.mjs";
|
|
7
|
+
import { BannerFunctionDeclaration, ColorsDeclaration, ConsoleBuiltin, DividerFunctionDeclaration, LinkFunctionDeclaration, MessageFunctionDeclaration, StripAnsiFunctionDeclaration, TableFunctionDeclaration, WrapAnsiFunction, WriteLineFunctionDeclaration } from "./console-builtin.mjs";
|
|
8
8
|
import { ArgsUtilities, ColorSupportUtilities, EnvSupportUtilities, ExitFunctionDeclaration, HyperlinkSupportUtilities, UtilsBuiltin } from "./utils-builtin.mjs";
|
|
9
9
|
|
|
10
|
-
export { ArgsUtilities, BinEntry, ColorSupportUtilities, ColorsDeclaration, CommandEntry, CommandHandlerDeclaration, CommandInvocation, CommandRouter, CommandRouterRoute, ConsoleBuiltin, DividerFunctionDeclaration, EnvSupportUtilities, ExitFunctionDeclaration, Help, HelpCommands, HelpOptions, HelpUsage, HyperlinkSupportUtilities, LinkFunctionDeclaration, MessageFunctionDeclaration, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserLogic, OptionsParserLogic, ParamsParserLogic, RunApplication, StripAnsiFunctionDeclaration, TableFunctionDeclaration, UtilsBuiltin, VariablePathsParserLogic, VirtualCommandEntry, VirtualCommandHandlerDeclaration, WrapAnsiFunction, WriteLineFunctionDeclaration };
|
|
10
|
+
export { ArgsUtilities, BannerFunctionDeclaration, BinEntry, ColorSupportUtilities, ColorsDeclaration, CommandEntry, CommandHandlerDeclaration, CommandInvocation, CommandRouter, CommandRouterRoute, ConsoleBuiltin, DividerFunctionDeclaration, EnvSupportUtilities, ExitFunctionDeclaration, Help, HelpCommands, HelpOptions, HelpUsage, HyperlinkSupportUtilities, LinkFunctionDeclaration, MessageFunctionDeclaration, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserLogic, OptionsParserLogic, ParamsParserLogic, RunApplication, StripAnsiFunctionDeclaration, TableFunctionDeclaration, UtilsBuiltin, VariablePathsParserLogic, VirtualCommandEntry, VirtualCommandHandlerDeclaration, WrapAnsiFunction, WriteLineFunctionDeclaration };
|