@shell-shock/plugin-help 0.1.2

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.
Files changed (80) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +264 -0
  3. package/dist/_virtual/_rolldown/runtime.cjs +29 -0
  4. package/dist/_virtual/_rolldown/runtime.mjs +3 -0
  5. package/dist/components/display.cjs +260 -0
  6. package/dist/components/display.d.cts +105 -0
  7. package/dist/components/display.d.cts.map +1 -0
  8. package/dist/components/display.d.mts +105 -0
  9. package/dist/components/display.d.mts.map +1 -0
  10. package/dist/components/display.mjs +254 -0
  11. package/dist/components/display.mjs.map +1 -0
  12. package/dist/components/help-builtin.cjs +113 -0
  13. package/dist/components/help-builtin.d.cts +22 -0
  14. package/dist/components/help-builtin.d.cts.map +1 -0
  15. package/dist/components/help-builtin.d.mts +22 -0
  16. package/dist/components/help-builtin.d.mts.map +1 -0
  17. package/dist/components/help-builtin.mjs +110 -0
  18. package/dist/components/help-builtin.mjs.map +1 -0
  19. package/dist/components/help-command.cjs +97 -0
  20. package/dist/components/help-command.d.cts +10 -0
  21. package/dist/components/help-command.d.cts.map +1 -0
  22. package/dist/components/help-command.d.mts +10 -0
  23. package/dist/components/help-command.d.mts.map +1 -0
  24. package/dist/components/help-command.mjs +96 -0
  25. package/dist/components/help-command.mjs.map +1 -0
  26. package/dist/components/index.cjs +14 -0
  27. package/dist/components/index.d.cts +4 -0
  28. package/dist/components/index.d.mts +4 -0
  29. package/dist/components/index.mjs +5 -0
  30. package/dist/index.cjs +105 -0
  31. package/dist/index.d.cts +11 -0
  32. package/dist/index.d.cts.map +1 -0
  33. package/dist/index.d.mts +11 -0
  34. package/dist/index.d.mts.map +1 -0
  35. package/dist/index.mjs +100 -0
  36. package/dist/index.mjs.map +1 -0
  37. package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.cjs +17 -0
  38. package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.mjs +17 -0
  39. package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.mjs.map +1 -0
  40. package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.cjs +38 -0
  41. package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.mjs +38 -0
  42. package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.mjs.map +1 -0
  43. package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.cjs +33 -0
  44. package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.mjs +34 -0
  45. package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.mjs.map +1 -0
  46. package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.cjs +40 -0
  47. package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.mjs +41 -0
  48. package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.mjs.map +1 -0
  49. package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.cjs +17 -0
  50. package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.mjs +17 -0
  51. package/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.mjs.map +1 -0
  52. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.cjs +20 -0
  53. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.mjs +21 -0
  54. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.mjs.map +1 -0
  55. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.cjs +12 -0
  56. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.mjs +12 -0
  57. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.mjs.map +1 -0
  58. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.cjs +20 -0
  59. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.mjs +21 -0
  60. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.mjs.map +1 -0
  61. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.cjs +19 -0
  62. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.mjs +20 -0
  63. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.mjs.map +1 -0
  64. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.cjs +12 -0
  65. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.mjs +12 -0
  66. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.mjs.map +1 -0
  67. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.cjs +8 -0
  68. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.mjs +8 -0
  69. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.mjs.map +1 -0
  70. package/dist/types/index.cjs +0 -0
  71. package/dist/types/index.d.cts +2 -0
  72. package/dist/types/index.d.mts +2 -0
  73. package/dist/types/index.mjs +1 -0
  74. package/dist/types/plugin.cjs +0 -0
  75. package/dist/types/plugin.d.cts +61 -0
  76. package/dist/types/plugin.d.cts.map +1 -0
  77. package/dist/types/plugin.d.mts +61 -0
  78. package/dist/types/plugin.d.mts.map +1 -0
  79. package/dist/types/plugin.mjs +1 -0
  80. package/package.json +177 -0
@@ -0,0 +1,260 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ const require_kebab_case = require('../node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.cjs');
4
+ const require_snake_case = require('../node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.cjs');
5
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
6
+ let _alloy_js_core = require("@alloy-js/core");
7
+ let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
8
+ let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
9
+ let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
10
+ let _shell_shock_core = require("@shell-shock/core");
11
+ let _shell_shock_plugin_theme_contexts_theme = require("@shell-shock/plugin-theme/contexts/theme");
12
+
13
+ //#region src/components/display.tsx
14
+ /**
15
+ * A component that generates the usage display for a command.
16
+ */
17
+ function HelpUsageDisplay(props) {
18
+ const { command, indent = 2 } = props;
19
+ const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
20
+ const theme = (0, _shell_shock_plugin_theme_contexts_theme.useTheme)();
21
+ return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
22
+ get each() {
23
+ return Object.keys(context.config.bin);
24
+ },
25
+ hardline: true,
26
+ children: (bin) => [(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`
27
+ writeLine(
28
+ colors.text.body.secondary(\`\$ \${colors.text.usage.bin("${bin}")}${command.segments.length > 0 ? ` ${command.segments.map((segment) => `\${colors.text.usage.${(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment) ? "dynamic" : "command"}("${(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment) ? `[${require_snake_case.snakeCase((0, _shell_shock_core_plugin_utils.getDynamicPathSegmentName)(segment))}]` : segment}")}`).join(" ")}` : ""}${Object.values(command.children).length > 0 ? ` \${colors.text.usage.dynamic("[command]")}` : ""}${command.args.length > 0 ? ` ${command.args.map((arg) => `\${colors.text.usage.args("<${require_snake_case.snakeCase((arg.kind === _shell_shock_core.CommandParameterKinds.string || arg.kind === _shell_shock_core.CommandParameterKinds.number) && arg.choices && arg.choices.length > 0 ? arg.choices.join("|") : arg.kind === _shell_shock_core.CommandParameterKinds.string && arg.format ? arg.format : arg.name)}${(arg.kind === _shell_shock_core.CommandParameterKinds.string || arg.kind === _shell_shock_core.CommandParameterKinds.number) && arg.variadic ? "..." : ""}>")}`).join(" ")}` : ""} \${colors.text.usage.options("[options]")}\`), { padding: ${theme.padding.app * indent} }
29
+ );`), (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})]
30
+ }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
31
+ get when() {
32
+ return command.args.length > 0;
33
+ },
34
+ get children() {
35
+ return [(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
36
+ get each() {
37
+ return Object.keys(context.config.bin);
38
+ },
39
+ hardline: true,
40
+ children: (bin) => [(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`
41
+ writeLine(
42
+ colors.text.body.secondary(\`\$ \${colors.text.usage.bin("${bin}")}${command.segments.length > 0 ? ` ${command.segments.map((segment) => `\${colors.text.usage.${(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment) ? "dynamic" : "command"}("${(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment) ? `[${require_snake_case.snakeCase((0, _shell_shock_core_plugin_utils.getDynamicPathSegmentName)(segment))}]` : segment}")}`).join(" ")}` : ""}${Object.values(command.children).length > 0 ? ` \${colors.text.usage.dynamic("[command]")}` : ""} \${colors.text.usage.options("[options]")}${command.args.length > 0 ? ` ${command.args.map((arg) => `\${colors.text.usage.args("<${require_snake_case.snakeCase((arg.kind === _shell_shock_core.CommandParameterKinds.string || arg.kind === _shell_shock_core.CommandParameterKinds.number) && arg.choices && arg.choices.length > 0 ? arg.choices.join("|") : arg.kind === _shell_shock_core.CommandParameterKinds.string && arg.format ? arg.format : arg.name)}${(arg.kind === _shell_shock_core.CommandParameterKinds.string || arg.kind === _shell_shock_core.CommandParameterKinds.number) && arg.variadic ? "..." : ""}>")}`).join(" ")}` : ""}\`), { padding: ${theme.padding.app * indent} }
43
+ );`), (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})]
44
+ })];
45
+ }
46
+ })];
47
+ }
48
+ /**
49
+ * A component that generates the options table display for a command.
50
+ */
51
+ function HelpOptionsDisplay(props) {
52
+ const { options } = props;
53
+ const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
54
+ return [
55
+ _alloy_js_core.code`table([ `,
56
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
57
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
58
+ get each() {
59
+ return (0, _shell_shock_core_plugin_utils.sortOptions)(options);
60
+ },
61
+ hardline: true,
62
+ children: (option) => {
63
+ const flags = [];
64
+ const names = [];
65
+ if (option.name.length === 1) flags.push(`-${option.name}`);
66
+ else names.push(`--${require_kebab_case.kebabCase(option.name)}`);
67
+ option.alias.forEach((alias) => {
68
+ if (alias.length === 1) flags.push(`-${alias}`);
69
+ else names.push(`--${require_kebab_case.kebabCase(alias)}`);
70
+ });
71
+ 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 === _shell_shock_core.CommandParameterKinds.string ? ` <${require_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 ? ` <${require_snake_case.snakeCase(option.choices && option.choices.length > 0 ? option.choices.join("|") : option.name)}${option.variadic ? "..." : ""}>` : ""}"), align: "right", border: "none", maxWidth: "1/3" }, { value: colors.text.body.tertiary(\`${(0, _shell_shock_core_plugin_utils.formatShortDescription)(option.description).replace(/\.+$/, "").trim()}${option.env || option.default !== void 0 ? ` (${option.env ? `env: ${context.config.appSpecificEnvPrefix}_${option.env}${option.default !== void 0 ? ", " : ""}` : ""}${option.default !== void 0 ? `default: ${JSON.stringify(option.default).replace(/"/g, "\\\"")}` : ""})` : ""}.\`), align: "left", border: "none" }], `;
72
+ }
73
+ }),
74
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
75
+ _alloy_js_core.code` ]); `
76
+ ];
77
+ }
78
+ /**
79
+ * A component that generates the commands table display for a command.
80
+ */
81
+ function HelpCommandsDisplay(props) {
82
+ const { commands } = props;
83
+ return [
84
+ _alloy_js_core.code`table([ `,
85
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
86
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
87
+ get each() {
88
+ return Object.values(commands);
89
+ },
90
+ hardline: true,
91
+ children: (child) => _alloy_js_core.code`[{ value: colors.text.body.primary("${child.name}"), align: "right", border: "none" }, { value: colors.text.body.tertiary(\`${(0, _shell_shock_core_plugin_utils.formatShortDescription)(child.description).replace(/\.+$/, "").trim()}.\`), align: "left", border: "none" }], `
92
+ }),
93
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
94
+ _alloy_js_core.code` ]); `
95
+ ];
96
+ }
97
+ /**
98
+ * A component that generates the `help` function declaration for a command.
99
+ */
100
+ function BaseHelpDisplay(props) {
101
+ const { command, indent = 1, filterGlobalOptions = false } = props;
102
+ const theme = (0, _shell_shock_plugin_theme_contexts_theme.useTheme)();
103
+ const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
104
+ 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));
105
+ return [
106
+ (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`writeLine(colors.bold(colors.text.heading.secondary("Usage:"))${indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : ""});`),
107
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
108
+ (0, _alloy_js_core_jsx_runtime.createComponent)(HelpUsageDisplay, {
109
+ command,
110
+ indent
111
+ }),
112
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
113
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
114
+ get when() {
115
+ return options.value.length > 0;
116
+ },
117
+ get children() {
118
+ return [
119
+ (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`writeLine("");
120
+ writeLine(colors.bold(colors.text.heading.secondary("Options:"))${indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : ""});`),
121
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
122
+ (0, _alloy_js_core_jsx_runtime.createComponent)(HelpOptionsDisplay, { get options() {
123
+ return options.value;
124
+ } }),
125
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
126
+ ];
127
+ }
128
+ }),
129
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
130
+ get when() {
131
+ return Object.keys(command.children).length > 0;
132
+ },
133
+ get children() {
134
+ return [
135
+ (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`writeLine("");
136
+ writeLine(colors.bold(colors.text.heading.secondary("Commands:"))${indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : ""});`),
137
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
138
+ (0, _alloy_js_core_jsx_runtime.createComponent)(HelpCommandsDisplay, { get commands() {
139
+ return command.children;
140
+ } }),
141
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
142
+ ];
143
+ }
144
+ })
145
+ ];
146
+ }
147
+ /**
148
+ * A component that generates the invocation of the `help` function for a command.
149
+ */
150
+ function VirtualCommandHelpDisplay(props) {
151
+ const { options, segments, commands } = props;
152
+ const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
153
+ return [
154
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
155
+ _alloy_js_core.code`writeLine(colors.bold(colors.text.heading.secondary("Global Options:")));`,
156
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
157
+ (0, _alloy_js_core_jsx_runtime.createComponent)(HelpOptionsDisplay, { options }),
158
+ _alloy_js_core.code`writeLine(""); `,
159
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
160
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
161
+ get when() {
162
+ return Object.keys(commands).length > 0;
163
+ },
164
+ get children() {
165
+ return [
166
+ (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`writeLine(colors.text.body.secondary("The following commands are available through the ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} command-line interface:"));
167
+ writeLine(""); `),
168
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
169
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
170
+ get each() {
171
+ return Object.values(commands);
172
+ },
173
+ doubleHardline: true,
174
+ joiner: _alloy_js_core.code`writeLine(""); `,
175
+ ender: _alloy_js_core.code`writeLine(""); `,
176
+ children: (child) => [
177
+ (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`
178
+ writeLine(colors.text.heading.primary(${child.icon ? `(isUnicodeSupported ? " ${child.icon} " : "") + ` : ""}"${child.title} ${child.isVirtual ? "" : "Command"}"));
179
+ writeLine("");
180
+ writeLine(colors.text.body.secondary(splitText(\`${(0, _shell_shock_core_plugin_utils.formatDescription)(child.description).replace(/\.+$/, "").trim()}.\`)));
181
+ writeLine("");
182
+ `),
183
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
184
+ (0, _alloy_js_core_jsx_runtime.createComponent)(BaseHelpDisplay, {
185
+ command: child,
186
+ indent: 2,
187
+ filterGlobalOptions: true
188
+ }),
189
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
190
+ ]
191
+ }),
192
+ (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`help("Running a specific command with the help flag (via: '${(0, _shell_shock_core_plugin_utils.getAppBin)(context)}${segments && segments.length > 0 ? ` ${segments.join(" ")}` : ""} <specific command> --help') will provide additional information that is specific to that command.");
193
+ writeLine("");`)
194
+ ];
195
+ }
196
+ })
197
+ ];
198
+ }
199
+ /**
200
+ * A component that generates the invocation of the `help` function for a command.
201
+ */
202
+ function CommandHelpDisplay(props) {
203
+ const { command } = props;
204
+ const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
205
+ return [
206
+ _alloy_js_core.code`writeLine(""); `,
207
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
208
+ (0, _alloy_js_core_jsx_runtime.createComponent)(BaseHelpDisplay, {
209
+ command,
210
+ filterGlobalOptions: false
211
+ }),
212
+ _alloy_js_core.code`writeLine(""); `,
213
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
214
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
215
+ get when() {
216
+ return Object.keys(command.children).length > 0;
217
+ },
218
+ get children() {
219
+ return [
220
+ _alloy_js_core.code`writeLine(colors.text.body.secondary("The following sub-commands are available:"));
221
+ writeLine(""); `,
222
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
223
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
224
+ get each() {
225
+ return Object.values(command.children);
226
+ },
227
+ doubleHardline: true,
228
+ joiner: _alloy_js_core.code`writeLine(""); `,
229
+ ender: _alloy_js_core.code`writeLine(""); `,
230
+ children: (child) => [
231
+ (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`
232
+ writeLine(colors.text.heading.primary(${child.icon ? `(isUnicodeSupported ? " ${child.icon} " : "") + ` : ""}"${child.title} ${child.isVirtual ? "" : "Command"}"));
233
+ writeLine("");
234
+ writeLine(colors.text.body.secondary(splitText(\`${(0, _shell_shock_core_plugin_utils.formatDescription)(child.description).replace(/\.+$/, "").trim()}.\`)));
235
+ writeLine("");
236
+ `),
237
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
238
+ (0, _alloy_js_core_jsx_runtime.createComponent)(BaseHelpDisplay, {
239
+ command: child,
240
+ indent: 2,
241
+ filterGlobalOptions: true
242
+ }),
243
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
244
+ ]
245
+ }),
246
+ (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`help("Running a specific command with the help flag (via: '${(0, _shell_shock_core_plugin_utils.getAppBin)(context)} ${command.segments.join(" ")} <specific command> --help') will provide additional information that is specific to that command.");
247
+ writeLine("");`)
248
+ ];
249
+ }
250
+ })
251
+ ];
252
+ }
253
+
254
+ //#endregion
255
+ exports.BaseHelpDisplay = BaseHelpDisplay;
256
+ exports.CommandHelpDisplay = CommandHelpDisplay;
257
+ exports.HelpCommandsDisplay = HelpCommandsDisplay;
258
+ exports.HelpOptionsDisplay = HelpOptionsDisplay;
259
+ exports.HelpUsageDisplay = HelpUsageDisplay;
260
+ exports.VirtualCommandHelpDisplay = VirtualCommandHelpDisplay;
@@ -0,0 +1,105 @@
1
+ import * as _alloy_js_core0 from "@alloy-js/core";
2
+ import { CommandOption, CommandTree } from "@shell-shock/core";
3
+
4
+ //#region src/components/display.d.ts
5
+ interface HelpUsageDisplayProps {
6
+ /**
7
+ * The command to generate help for.
8
+ */
9
+ command: CommandTree;
10
+ /**
11
+ * The padding scale to apply to the help display headings.
12
+ *
13
+ * @remarks
14
+ * This value is multiplied by the theme's app padding to determine the final padding.
15
+ *
16
+ * @defaultValue 2
17
+ */
18
+ indent?: number;
19
+ }
20
+ /**
21
+ * A component that generates the usage display for a command.
22
+ */
23
+ declare function HelpUsageDisplay(props: HelpUsageDisplayProps): _alloy_js_core0.Children;
24
+ interface HelpOptionsDisplayProps {
25
+ /**
26
+ * The options to display help for.
27
+ */
28
+ options: CommandOption[];
29
+ }
30
+ /**
31
+ * A component that generates the options table display for a command.
32
+ */
33
+ declare function HelpOptionsDisplay(props: HelpOptionsDisplayProps): _alloy_js_core0.Children;
34
+ interface HelpCommandsDisplayProps {
35
+ /**
36
+ * A mapping of command names to their command definitions.
37
+ */
38
+ commands: Record<string, CommandTree>;
39
+ }
40
+ /**
41
+ * A component that generates the commands table display for a command.
42
+ */
43
+ declare function HelpCommandsDisplay(props: HelpCommandsDisplayProps): _alloy_js_core0.Children;
44
+ interface BaseHelpDisplayProps {
45
+ /**
46
+ * The command to generate help for.
47
+ */
48
+ command: CommandTree;
49
+ /**
50
+ * Whether to filter out global options from the help display.
51
+ *
52
+ * @remarks
53
+ * When enabled, any options that are present in the global options context will be filtered out from the help display. This is useful for sub-commands to avoid displaying global options that are not relevant to the specific command.
54
+ *
55
+ * @defaultValue false
56
+ */
57
+ filterGlobalOptions?: boolean;
58
+ /**
59
+ * The padding scale to apply to the help display headings.
60
+ *
61
+ * @remarks
62
+ * This value is multiplied by the theme's app padding to determine the final padding.
63
+ *
64
+ * @defaultValue 1
65
+ */
66
+ indent?: number;
67
+ }
68
+ /**
69
+ * A component that generates the `help` function declaration for a command.
70
+ */
71
+ declare function BaseHelpDisplay(props: BaseHelpDisplayProps): _alloy_js_core0.Children;
72
+ interface VirtualCommandHelpDisplayProps {
73
+ /**
74
+ * The options to display help for.
75
+ */
76
+ options: CommandOption[];
77
+ /**
78
+ * A mapping of command names to their command definitions.
79
+ */
80
+ commands: Record<string, CommandTree>;
81
+ /**
82
+ * The command path to generate help for, used for generating the help invocation instructions.
83
+ *
84
+ * @remarks
85
+ * This is optional since the virtual command entry component can be used for both the global binary executable and virtual commands (there will be no command definition for the binary executable).
86
+ */
87
+ segments?: string[];
88
+ }
89
+ /**
90
+ * A component that generates the invocation of the `help` function for a command.
91
+ */
92
+ declare function VirtualCommandHelpDisplay(props: VirtualCommandHelpDisplayProps): _alloy_js_core0.Children;
93
+ interface CommandHelpDisplayProps {
94
+ /**
95
+ * A mapping of command names to their command definitions.
96
+ */
97
+ command: CommandTree;
98
+ }
99
+ /**
100
+ * A component that generates the invocation of the `help` function for a command.
101
+ */
102
+ declare function CommandHelpDisplay(props: CommandHelpDisplayProps): _alloy_js_core0.Children;
103
+ //#endregion
104
+ export { BaseHelpDisplay, BaseHelpDisplayProps, CommandHelpDisplay, CommandHelpDisplayProps, HelpCommandsDisplay, HelpCommandsDisplayProps, HelpOptionsDisplay, HelpOptionsDisplayProps, HelpUsageDisplay, HelpUsageDisplayProps, VirtualCommandHelpDisplay, VirtualCommandHelpDisplayProps };
105
+ //# sourceMappingURL=display.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"display.d.cts","names":[],"sources":["../../src/components/display.tsx"],"mappings":";;;;UAqCiB,qBAAA;;;AAAjB;EAIE,OAAA,EAAS,WAAA;;;;;;;;AAgBX;EANE,MAAA;AAAA;;;;iBAMc,gBAAA,CAAiB,KAAA,EAAO,qBAAA,GAAqB,eAAA,CAAA,QAAA;AAAA,UAiH5C,uBAAA;EAjH4C;AAiH7D;;EAIE,OAAA,EAAS,aAAA;AAAA;;AAMX;;iBAAgB,kBAAA,CAAmB,KAAA,EAAO,uBAAA,GAAuB,eAAA,CAAA,QAAA;AAAA,UA0EhD,wBAAA;EA1EyB;;;EA8ExC,QAAA,EAAU,MAAA,SAAe,WAAA;AAAA;AAJ3B;;;AAAA,iBAUgB,mBAAA,CAAoB,KAAA,EAAO,wBAAA,GAAwB,eAAA,CAAA,QAAA;AAAA,UAwBlD,oBAAA;EA9BL;;;EAkCV,OAAA,EAAS,WAAA;EA5BK;;;;;;;;EAsCd,mBAAA;EAde;;;;;;;;EAwBf,MAAA;AAAA;AAMF;;;AAAA,iBAAgB,eAAA,CAAgB,KAAA,EAAO,oBAAA,GAAoB,eAAA,CAAA,QAAA;AAAA,UAmD1C,8BAAA;EAnDe;;;EAuD9B,OAAA,EAAS,aAAA;EAJM;;;EASf,QAAA,EAAU,MAAA,SAAe,WAAA;EAAA;;;;;;EAQzB,QAAA;AAAA;;;;iBAMc,yBAAA,CACd,KAAA,EAAO,8BAAA,GAA8B,eAAA,CAAA,QAAA;AAAA,UA2DtB,uBAAA;EA5DwB;;;EAgEvC,OAAA,EAAS,WAAA;AAAA;;;;iBAMK,kBAAA,CAAmB,KAAA,EAAO,uBAAA,GAAuB,eAAA,CAAA,QAAA"}
@@ -0,0 +1,105 @@
1
+ import * as _alloy_js_core0 from "@alloy-js/core";
2
+ import { CommandOption, CommandTree } from "@shell-shock/core";
3
+
4
+ //#region src/components/display.d.ts
5
+ interface HelpUsageDisplayProps {
6
+ /**
7
+ * The command to generate help for.
8
+ */
9
+ command: CommandTree;
10
+ /**
11
+ * The padding scale to apply to the help display headings.
12
+ *
13
+ * @remarks
14
+ * This value is multiplied by the theme's app padding to determine the final padding.
15
+ *
16
+ * @defaultValue 2
17
+ */
18
+ indent?: number;
19
+ }
20
+ /**
21
+ * A component that generates the usage display for a command.
22
+ */
23
+ declare function HelpUsageDisplay(props: HelpUsageDisplayProps): _alloy_js_core0.Children;
24
+ interface HelpOptionsDisplayProps {
25
+ /**
26
+ * The options to display help for.
27
+ */
28
+ options: CommandOption[];
29
+ }
30
+ /**
31
+ * A component that generates the options table display for a command.
32
+ */
33
+ declare function HelpOptionsDisplay(props: HelpOptionsDisplayProps): _alloy_js_core0.Children;
34
+ interface HelpCommandsDisplayProps {
35
+ /**
36
+ * A mapping of command names to their command definitions.
37
+ */
38
+ commands: Record<string, CommandTree>;
39
+ }
40
+ /**
41
+ * A component that generates the commands table display for a command.
42
+ */
43
+ declare function HelpCommandsDisplay(props: HelpCommandsDisplayProps): _alloy_js_core0.Children;
44
+ interface BaseHelpDisplayProps {
45
+ /**
46
+ * The command to generate help for.
47
+ */
48
+ command: CommandTree;
49
+ /**
50
+ * Whether to filter out global options from the help display.
51
+ *
52
+ * @remarks
53
+ * When enabled, any options that are present in the global options context will be filtered out from the help display. This is useful for sub-commands to avoid displaying global options that are not relevant to the specific command.
54
+ *
55
+ * @defaultValue false
56
+ */
57
+ filterGlobalOptions?: boolean;
58
+ /**
59
+ * The padding scale to apply to the help display headings.
60
+ *
61
+ * @remarks
62
+ * This value is multiplied by the theme's app padding to determine the final padding.
63
+ *
64
+ * @defaultValue 1
65
+ */
66
+ indent?: number;
67
+ }
68
+ /**
69
+ * A component that generates the `help` function declaration for a command.
70
+ */
71
+ declare function BaseHelpDisplay(props: BaseHelpDisplayProps): _alloy_js_core0.Children;
72
+ interface VirtualCommandHelpDisplayProps {
73
+ /**
74
+ * The options to display help for.
75
+ */
76
+ options: CommandOption[];
77
+ /**
78
+ * A mapping of command names to their command definitions.
79
+ */
80
+ commands: Record<string, CommandTree>;
81
+ /**
82
+ * The command path to generate help for, used for generating the help invocation instructions.
83
+ *
84
+ * @remarks
85
+ * This is optional since the virtual command entry component can be used for both the global binary executable and virtual commands (there will be no command definition for the binary executable).
86
+ */
87
+ segments?: string[];
88
+ }
89
+ /**
90
+ * A component that generates the invocation of the `help` function for a command.
91
+ */
92
+ declare function VirtualCommandHelpDisplay(props: VirtualCommandHelpDisplayProps): _alloy_js_core0.Children;
93
+ interface CommandHelpDisplayProps {
94
+ /**
95
+ * A mapping of command names to their command definitions.
96
+ */
97
+ command: CommandTree;
98
+ }
99
+ /**
100
+ * A component that generates the invocation of the `help` function for a command.
101
+ */
102
+ declare function CommandHelpDisplay(props: CommandHelpDisplayProps): _alloy_js_core0.Children;
103
+ //#endregion
104
+ export { BaseHelpDisplay, BaseHelpDisplayProps, CommandHelpDisplay, CommandHelpDisplayProps, HelpCommandsDisplay, HelpCommandsDisplayProps, HelpOptionsDisplay, HelpOptionsDisplayProps, HelpUsageDisplay, HelpUsageDisplayProps, VirtualCommandHelpDisplay, VirtualCommandHelpDisplayProps };
105
+ //# sourceMappingURL=display.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"display.d.mts","names":[],"sources":["../../src/components/display.tsx"],"mappings":";;;;UAqCiB,qBAAA;;;AAAjB;EAIE,OAAA,EAAS,WAAA;;;;;;;;AAgBX;EANE,MAAA;AAAA;;;;iBAMc,gBAAA,CAAiB,KAAA,EAAO,qBAAA,GAAqB,eAAA,CAAA,QAAA;AAAA,UAiH5C,uBAAA;EAjH4C;AAiH7D;;EAIE,OAAA,EAAS,aAAA;AAAA;;AAMX;;iBAAgB,kBAAA,CAAmB,KAAA,EAAO,uBAAA,GAAuB,eAAA,CAAA,QAAA;AAAA,UA0EhD,wBAAA;EA1EyB;;;EA8ExC,QAAA,EAAU,MAAA,SAAe,WAAA;AAAA;AAJ3B;;;AAAA,iBAUgB,mBAAA,CAAoB,KAAA,EAAO,wBAAA,GAAwB,eAAA,CAAA,QAAA;AAAA,UAwBlD,oBAAA;EA9BL;;;EAkCV,OAAA,EAAS,WAAA;EA5BK;;;;;;;;EAsCd,mBAAA;EAde;;;;;;;;EAwBf,MAAA;AAAA;AAMF;;;AAAA,iBAAgB,eAAA,CAAgB,KAAA,EAAO,oBAAA,GAAoB,eAAA,CAAA,QAAA;AAAA,UAmD1C,8BAAA;EAnDe;;;EAuD9B,OAAA,EAAS,aAAA;EAJM;;;EASf,QAAA,EAAU,MAAA,SAAe,WAAA;EAAA;;;;;;EAQzB,QAAA;AAAA;;;;iBAMc,yBAAA,CACd,KAAA,EAAO,8BAAA,GAA8B,eAAA,CAAA,QAAA;AAAA,UA2DtB,uBAAA;EA5DwB;;;EAgEvC,OAAA,EAAS,WAAA;AAAA;;;;iBAMK,kBAAA,CAAmB,KAAA,EAAO,uBAAA,GAAuB,eAAA,CAAA,QAAA"}