@shell-shock/preset-script 0.6.22 → 0.6.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +1 -1
- package/dist/_virtual/_rolldown/runtime.mjs +3 -0
- package/dist/components/banner-function-declaration.cjs +28 -27
- package/dist/components/banner-function-declaration.cjs.map +1 -1
- package/dist/components/banner-function-declaration.d.cts.map +1 -1
- package/dist/components/banner-function-declaration.d.mts.map +1 -1
- package/dist/components/banner-function-declaration.mjs +2 -2
- package/dist/components/banner-function-declaration.mjs.map +1 -1
- package/dist/components/bin-entry.cjs +54 -45
- package/dist/components/bin-entry.cjs.map +1 -1
- package/dist/components/bin-entry.d.cts +0 -1
- package/dist/components/bin-entry.d.cts.map +1 -1
- package/dist/components/bin-entry.d.mts +0 -1
- package/dist/components/bin-entry.d.mts.map +1 -1
- package/dist/components/bin-entry.mjs +17 -9
- package/dist/components/bin-entry.mjs.map +1 -1
- package/dist/components/command-entry.cjs +78 -237
- package/dist/components/command-entry.cjs.map +1 -1
- package/dist/components/command-entry.d.cts +1 -8
- package/dist/components/command-entry.d.cts.map +1 -1
- package/dist/components/command-entry.d.mts +2 -9
- package/dist/components/command-entry.d.mts.map +1 -1
- package/dist/components/command-entry.mjs +26 -185
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.cjs +85 -83
- package/dist/components/command-router.cjs.map +1 -1
- package/dist/components/command-router.d.cts.map +1 -1
- package/dist/components/command-router.d.mts.map +1 -1
- package/dist/components/command-router.mjs +59 -58
- package/dist/components/command-router.mjs.map +1 -1
- package/dist/components/exit-function-declaration.cjs +38 -37
- package/dist/components/exit-function-declaration.cjs.map +1 -1
- package/dist/components/exit-function-declaration.d.cts +2 -2
- package/dist/components/exit-function-declaration.d.cts.map +1 -1
- package/dist/components/exit-function-declaration.d.mts +2 -2
- package/dist/components/exit-function-declaration.d.mts.map +1 -1
- package/dist/components/exit-function-declaration.mjs +3 -3
- package/dist/components/exit-function-declaration.mjs.map +1 -1
- package/dist/components/index.cjs +2 -9
- package/dist/components/index.d.cts +2 -3
- package/dist/components/index.d.mts +2 -3
- package/dist/components/index.mjs +2 -3
- package/dist/components/virtual-command-entry.cjs +43 -59
- package/dist/components/virtual-command-entry.cjs.map +1 -1
- package/dist/components/virtual-command-entry.d.cts.map +1 -1
- package/dist/components/virtual-command-entry.d.mts.map +1 -1
- package/dist/components/virtual-command-entry.mjs +13 -30
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- package/dist/helpers/get-default-options.cjs +8 -7
- package/dist/helpers/get-default-options.cjs.map +1 -1
- package/dist/helpers/get-default-options.d.cts +0 -1
- package/dist/helpers/get-default-options.d.cts.map +1 -1
- package/dist/helpers/get-default-options.d.mts +0 -1
- package/dist/helpers/get-default-options.d.mts.map +1 -1
- package/dist/helpers/get-default-options.mjs.map +1 -1
- package/dist/index.cjs +30 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +8 -20
- package/dist/index.mjs.map +1 -1
- package/dist/plugin-help/dist/components/display.cjs +260 -0
- package/dist/plugin-help/dist/components/display.cjs.map +1 -0
- package/dist/{components/help.mjs → plugin-help/dist/components/display.mjs} +30 -34
- package/dist/plugin-help/dist/components/display.mjs.map +1 -0
- package/dist/plugin-help/dist/components/help-builtin.cjs +86 -0
- package/dist/plugin-help/dist/components/help-builtin.cjs.map +1 -0
- package/dist/plugin-help/dist/components/help-builtin.mjs +84 -0
- package/dist/plugin-help/dist/components/help-builtin.mjs.map +1 -0
- package/dist/plugin-help/dist/components/help-command.cjs +97 -0
- package/dist/plugin-help/dist/components/help-command.cjs.map +1 -0
- package/dist/plugin-help/dist/components/help-command.mjs +96 -0
- package/dist/plugin-help/dist/components/help-command.mjs.map +1 -0
- package/dist/plugin-help/dist/components/index.cjs +3 -0
- package/dist/plugin-help/dist/components/index.mjs +5 -0
- package/dist/plugin-help/dist/index.cjs +104 -0
- package/dist/plugin-help/dist/index.cjs.map +1 -0
- package/dist/plugin-help/dist/index.d.cts +2 -0
- package/dist/plugin-help/dist/index.d.mts +2 -0
- package/dist/plugin-help/dist/index.mjs +100 -0
- package/dist/plugin-help/dist/index.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.cjs +18 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.mjs +17 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.cjs +39 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.mjs +38 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.cjs +34 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.mjs +34 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.cjs +41 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.mjs +41 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.cjs +18 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.mjs +17 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.cjs +21 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.mjs +21 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.cjs +13 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.mjs +12 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.cjs +21 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.mjs +21 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.cjs +20 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.mjs +20 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.cjs +13 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.mjs +12 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.cjs +9 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.mjs +8 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.mjs.map +1 -0
- package/dist/plugin-help/dist/types/plugin.d.cts +62 -0
- package/dist/plugin-help/dist/types/plugin.d.cts.map +1 -0
- package/dist/plugin-help/dist/types/plugin.d.mts +62 -0
- package/dist/plugin-help/dist/types/plugin.d.mts.map +1 -0
- package/dist/types/plugin.d.cts +9 -9
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +9 -9
- package/dist/types/plugin.d.mts.map +1 -1
- package/package.json +15 -29
- package/dist/components/help.cjs +0 -264
- package/dist/components/help.cjs.map +0 -1
- package/dist/components/help.d.cts +0 -105
- package/dist/components/help.d.cts.map +0 -1
- package/dist/components/help.d.mts +0 -105
- package/dist/components/help.d.mts.map +0 -1
- package/dist/components/help.mjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
Object.
|
|
2
|
-
const
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_index = require('./plugin-help/dist/index.cjs');
|
|
3
4
|
const require_components_banner_function_declaration = require('./components/banner-function-declaration.cjs');
|
|
4
5
|
const require_components_bin_entry = require('./components/bin-entry.cjs');
|
|
5
|
-
const require_components_help = require('./components/help.cjs');
|
|
6
6
|
const require_components_command_router = require('./components/command-router.cjs');
|
|
7
7
|
const require_components_virtual_command_entry = require('./components/virtual-command-entry.cjs');
|
|
8
8
|
const require_components_command_entry = require('./components/command-entry.cjs');
|
|
9
9
|
require('./components/index.cjs');
|
|
10
10
|
const require_helpers_get_default_options = require('./helpers/get-default-options.cjs');
|
|
11
|
-
let
|
|
12
|
-
let
|
|
13
|
-
let
|
|
14
|
-
let
|
|
15
|
-
let
|
|
16
|
-
|
|
11
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
12
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
13
|
+
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
14
|
+
let _powerlines_plugin_alloy_core_components = require("@powerlines/plugin-alloy/core/components");
|
|
15
|
+
let _powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
|
|
16
|
+
let _shell_shock_plugin_console = require("@shell-shock/plugin-console");
|
|
17
|
+
_shell_shock_plugin_console = require_runtime.__toESM(_shell_shock_plugin_console);
|
|
17
18
|
|
|
18
19
|
//#region src/index.tsx
|
|
19
20
|
/**
|
|
@@ -21,7 +22,8 @@ __shell_shock_plugin_console = require_rolldown_runtime.__toESM(__shell_shock_pl
|
|
|
21
22
|
*/
|
|
22
23
|
const plugin = (options = {}) => {
|
|
23
24
|
return [
|
|
24
|
-
(0,
|
|
25
|
+
(0, _shell_shock_plugin_console.default)(options),
|
|
26
|
+
...require_index.plugin(options),
|
|
25
27
|
{
|
|
26
28
|
name: "shell-shock:script-preset",
|
|
27
29
|
config() {
|
|
@@ -40,7 +42,7 @@ const plugin = (options = {}) => {
|
|
|
40
42
|
async handler() {
|
|
41
43
|
const _self$ = this;
|
|
42
44
|
this.debug("Rendering entrypoint modules for the Shell Shock `script` preset.");
|
|
43
|
-
return (0,
|
|
45
|
+
return (0, _powerlines_plugin_alloy_render.render)(this, [(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_bin_entry.BinEntry, {
|
|
44
46
|
builtinImports: {
|
|
45
47
|
console: [
|
|
46
48
|
"divider",
|
|
@@ -57,71 +59,58 @@ const plugin = (options = {}) => {
|
|
|
57
59
|
]
|
|
58
60
|
},
|
|
59
61
|
get prefix() {
|
|
60
|
-
return [
|
|
61
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(require_components_banner_function_declaration.BannerFunctionDeclaration, {}),
|
|
62
|
-
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
63
|
-
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
64
|
-
];
|
|
62
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_banner_function_declaration.BannerFunctionDeclaration, {}), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {})];
|
|
65
63
|
},
|
|
66
64
|
get children() {
|
|
67
65
|
return [
|
|
68
|
-
(0,
|
|
66
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
69
67
|
get when() {
|
|
70
68
|
return Object.keys(_self$.commands).length > 0;
|
|
71
69
|
},
|
|
72
70
|
get children() {
|
|
73
71
|
return [
|
|
74
|
-
(0,
|
|
72
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
75
73
|
"const": true,
|
|
76
74
|
name: "args",
|
|
77
75
|
type: "string[]",
|
|
78
|
-
initializer:
|
|
76
|
+
initializer: _alloy_js_core.code`useArgs();`
|
|
79
77
|
}),
|
|
80
|
-
(0,
|
|
81
|
-
(0,
|
|
78
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
79
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_command_router.CommandRouter, {
|
|
82
80
|
segments: [],
|
|
83
81
|
get commands() {
|
|
84
82
|
return _self$.commands ?? {};
|
|
85
83
|
}
|
|
86
84
|
}),
|
|
87
|
-
(0,
|
|
85
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
88
86
|
];
|
|
89
87
|
}
|
|
90
88
|
}),
|
|
91
|
-
(0,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
96
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(require_components_help.VirtualHelp, {
|
|
97
|
-
get options() {
|
|
98
|
-
return _self$.options;
|
|
99
|
-
},
|
|
100
|
-
get commands() {
|
|
101
|
-
return _self$.commands ?? {};
|
|
102
|
-
}
|
|
103
|
-
})
|
|
89
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}),
|
|
90
|
+
_alloy_js_core.code`banner();`,
|
|
91
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}),
|
|
92
|
+
_alloy_js_core.code`return showHelp();`
|
|
104
93
|
];
|
|
105
94
|
}
|
|
106
|
-
}), (0,
|
|
95
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
107
96
|
get when() {
|
|
108
97
|
return Object.values(_self$.commands).length > 0;
|
|
109
98
|
},
|
|
110
99
|
get children() {
|
|
111
|
-
return (0,
|
|
100
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
112
101
|
get each() {
|
|
113
102
|
return Object.values(_self$.commands);
|
|
114
103
|
},
|
|
115
104
|
doubleHardline: true,
|
|
116
|
-
children: (child) => (0,
|
|
105
|
+
children: (child) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
117
106
|
get when() {
|
|
118
107
|
return child.isVirtual;
|
|
119
108
|
},
|
|
120
109
|
get fallback() {
|
|
121
|
-
return (0,
|
|
110
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_command_entry.CommandEntry, { command: child });
|
|
122
111
|
},
|
|
123
112
|
get children() {
|
|
124
|
-
return (0,
|
|
113
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_virtual_command_entry.VirtualCommandEntry, { command: child });
|
|
125
114
|
}
|
|
126
115
|
})
|
|
127
116
|
});
|
|
@@ -132,9 +121,8 @@ const plugin = (options = {}) => {
|
|
|
132
121
|
}
|
|
133
122
|
];
|
|
134
123
|
};
|
|
135
|
-
var src_default = plugin;
|
|
136
124
|
|
|
137
125
|
//#endregion
|
|
138
|
-
exports.default =
|
|
126
|
+
exports.default = plugin;
|
|
139
127
|
exports.plugin = plugin;
|
|
140
128
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../src/index.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 { VarDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport console from \"@shell-shock/plugin-console\";\nimport help from \"@shell-shock/plugin-help\";\nimport type { Plugin } from \"powerlines\";\nimport { BannerFunctionDeclaration } from \"./components\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { ScriptPresetContext, ScriptPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <\n TContext extends ScriptPresetContext = ScriptPresetContext\n>(\n options: ScriptPresetOptions = {}\n) => {\n return [\n console(options),\n ...help(options),\n {\n name: \"shell-shock:script-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `script` preset.\"\n );\n\n return {\n defaultOptions: getDefaultOptions,\n isCaseSensitive: false,\n ...options\n };\n }\n },\n {\n name: \"shell-shock:script-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\n \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"colors\",\n \"help\"\n ],\n utils: [\"useApp\", \"useArgs\", \"isMinimal\"]\n }}\n prefix={\n <>\n <BannerFunctionDeclaration />\n <Spacing />\n </>\n }>\n <Show when={Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`useArgs();`}\n />\n <hbr />\n <CommandRouter segments={[]} commands={this.commands ?? {}} />\n <hbr />\n </Show>\n <Spacing />\n {code`banner();`}\n <Spacing />\n {code`return showHelp();`}\n </BinEntry>\n <Show when={Object.values(this.commands).length > 0}>\n <For each={Object.values(this.commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </Show>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAW,UAA8B,UAAA,EAAA,KAAA;AACxC,QAAA;2CAAA,QAAA;EAAA,GAAA,qBAAA,QAAA;EAAA;GACC,MAAQ;GACN,SAAC;AACH,SAAO,MAAA,uEAAA;AACL,WAAQ;KACL,gBAAa;KAChB,iBAAA;KACE,GAAK;KACL;;GAEH;EAAE;GACD,MAAK;;IAEH,OAAE;IACF,MAAI,UAAA;KACF,MAAE,SAAA;AACF,UAAK,MAAA,oEAAA;AACL,wDAAC,MAAA,iDAAA,uCAAA;MACH,gBAAA;OACD,SAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;OACD,OAAA;QAAA;QAAA;QAAA;QAAA;OACO;MACL,IAAQ,SAAC;AACP,cAAQ,iDAAK,0EAAA,EAAA,CAAA,kDAAA,kDAAA,EAAA,CAAA,CAAA;;MAEX,IAAI,WAAM;AACR,cAAC;wDAAqB,qBAAQ;SAC/B,IAAA,OAAA;;;SAGC,IAAI,WAAA;AACH,iBAAA;2DAAA,qCAAA;YACE,SAAA;YACC,MAAA;YACE,MAAA;YACA,aAAW,mBAAA;YACZ,CAAC;2DAAa,OAAA,EAAA,CAAA;2DAAA,iDAAA;YACb,UAAG,EAAS;YACZ,IAAG,WAAU;AACX,oBAAO,OAAC,YAAA,EAAA;;YAEX,CAAC;2DAAC,OAAA,EAAA,CAAA;WAAA;;SAEN,CAAC;wDAAG,kDAAA,EAAA,CAAA;QAAA,mBAAA;wDAAA,kDAAA,EAAA,CAAA;QAAA,mBAAA;QAAA;;MAER,CAAC,kDAAS,qBAAA;MACT,IAAI,OAAO;AACT,cAAO,OAAE,OAAS,OAAA,SAAA,CAAA,SAAA;;MAEpB,IAAI,WAAG;AACL,8DAAuB,oBAAK;QAC1B,IAAI,OAAC;AACH,gBAAI,OAAA,OAAA,OAAA,SAAA;;QAEN,gBAAY;QACZ,WAAM,0DAA6B,qBAAA;SACjC,IAAG,OAAA;AACD,iBAAM,MAAA;;SAER,IAAG,WAAK;AACN,iEAAI,+CAAA,EACL,SAAS,OACT,CAAA;;SAED,IAAC,WAAY;AACb,iEAAQ,8DAAA,EACJ,SAAM,OACT,CAAG;;SAEL,CAAC;QACH,CAAC;;MAEL,CAAC,CAAC,CAAC;;IAEP;GACF;EAAC"}
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;AAoCA;cAAa,MAAA,oBACM,mBAAA,GAAsB,mBAAA,EAEvC,OAAA,GAAS,mBAAA,KAiFJ,MAAA,CAAO,QAAA"}
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;AAoCA;cAAa,MAAA,oBACM,mBAAA,GAAsB,mBAAA,EAEvC,OAAA,GAAS,mBAAA,KAiFJ,MAAA,CAAO,QAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { plugin as plugin$1 } from "./plugin-help/dist/index.mjs";
|
|
1
2
|
import { BannerFunctionDeclaration } from "./components/banner-function-declaration.mjs";
|
|
2
3
|
import { BinEntry } from "./components/bin-entry.mjs";
|
|
3
|
-
import { VirtualHelp } from "./components/help.mjs";
|
|
4
4
|
import { CommandRouter } from "./components/command-router.mjs";
|
|
5
5
|
import { VirtualCommandEntry } from "./components/virtual-command-entry.mjs";
|
|
6
6
|
import { CommandEntry } from "./components/command-entry.mjs";
|
|
@@ -9,6 +9,7 @@ import { getDefaultOptions } from "./helpers/get-default-options.mjs";
|
|
|
9
9
|
import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
|
|
10
10
|
import { For, Show, code } from "@alloy-js/core";
|
|
11
11
|
import { VarDeclaration } from "@alloy-js/typescript";
|
|
12
|
+
import { Spacing } from "@powerlines/plugin-alloy/core/components";
|
|
12
13
|
import { render } from "@powerlines/plugin-alloy/render";
|
|
13
14
|
import console from "@shell-shock/plugin-console";
|
|
14
15
|
|
|
@@ -19,6 +20,7 @@ import console from "@shell-shock/plugin-console";
|
|
|
19
20
|
const plugin = (options = {}) => {
|
|
20
21
|
return [
|
|
21
22
|
console(options),
|
|
23
|
+
...plugin$1(options),
|
|
22
24
|
{
|
|
23
25
|
name: "shell-shock:script-preset",
|
|
24
26
|
config() {
|
|
@@ -54,11 +56,7 @@ const plugin = (options = {}) => {
|
|
|
54
56
|
]
|
|
55
57
|
},
|
|
56
58
|
get prefix() {
|
|
57
|
-
return [
|
|
58
|
-
createComponent(BannerFunctionDeclaration, {}),
|
|
59
|
-
createIntrinsic("hbr", {}),
|
|
60
|
-
createIntrinsic("hbr", {})
|
|
61
|
-
];
|
|
59
|
+
return [createComponent(BannerFunctionDeclaration, {}), createComponent(Spacing, {})];
|
|
62
60
|
},
|
|
63
61
|
get children() {
|
|
64
62
|
return [
|
|
@@ -85,19 +83,10 @@ const plugin = (options = {}) => {
|
|
|
85
83
|
];
|
|
86
84
|
}
|
|
87
85
|
}),
|
|
88
|
-
|
|
89
|
-
createIntrinsic("hbr", {}),
|
|
86
|
+
createComponent(Spacing, {}),
|
|
90
87
|
code`banner();`,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
createComponent(VirtualHelp, {
|
|
94
|
-
get options() {
|
|
95
|
-
return _self$.options;
|
|
96
|
-
},
|
|
97
|
-
get commands() {
|
|
98
|
-
return _self$.commands ?? {};
|
|
99
|
-
}
|
|
100
|
-
})
|
|
88
|
+
createComponent(Spacing, {}),
|
|
89
|
+
code`return showHelp();`
|
|
101
90
|
];
|
|
102
91
|
}
|
|
103
92
|
}), createComponent(Show, {
|
|
@@ -129,8 +118,7 @@ const plugin = (options = {}) => {
|
|
|
129
118
|
}
|
|
130
119
|
];
|
|
131
120
|
};
|
|
132
|
-
var src_default = plugin;
|
|
133
121
|
|
|
134
122
|
//#endregion
|
|
135
|
-
export {
|
|
123
|
+
export { plugin as default, plugin };
|
|
136
124
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.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 { VarDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport console from \"@shell-shock/plugin-console\";\nimport help from \"@shell-shock/plugin-help\";\nimport type { Plugin } from \"powerlines\";\nimport { BannerFunctionDeclaration } from \"./components\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { ScriptPresetContext, ScriptPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <\n TContext extends ScriptPresetContext = ScriptPresetContext\n>(\n options: ScriptPresetOptions = {}\n) => {\n return [\n console(options),\n ...help(options),\n {\n name: \"shell-shock:script-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `script` preset.\"\n );\n\n return {\n defaultOptions: getDefaultOptions,\n isCaseSensitive: false,\n ...options\n };\n }\n },\n {\n name: \"shell-shock:script-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\n \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"colors\",\n \"help\"\n ],\n utils: [\"useApp\", \"useArgs\", \"isMinimal\"]\n }}\n prefix={\n <>\n <BannerFunctionDeclaration />\n <Spacing />\n </>\n }>\n <Show when={Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`useArgs();`}\n />\n <hbr />\n <CommandRouter segments={[]} commands={this.commands ?? {}} />\n <hbr />\n </Show>\n <Spacing />\n {code`banner();`}\n <Spacing />\n {code`return showHelp();`}\n </BinEntry>\n <Show when={Object.values(this.commands).length > 0}>\n <For each={Object.values(this.commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </Show>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqCA,MAAW,UAA8B,UAAA,EAAA,KAAA;AACxC,QAAA;EAAA,QAAA,QAAA;EAAA,GAAA,SAAA,QAAA;EAAA;GACC,MAAQ;GACN,SAAC;AACH,SAAO,MAAA,uEAAA;AACL,WAAQ;KACL,gBAAa;KAChB,iBAAA;KACE,GAAK;KACL;;GAEH;EAAE;GACD,MAAK;;IAEH,OAAE;IACF,MAAI,UAAA;KACF,MAAE,SAAA;AACF,UAAK,MAAA,oEAAA;AACL,YAAC,OAAA,MAAA,CAAA,gBAAA,UAAA;MACH,gBAAA;OACD,SAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;OACD,OAAA;QAAA;QAAA;QAAA;QAAA;OACO;MACL,IAAQ,SAAC;AACP,cAAQ,CAAI,gBAAC,2BAAA,EAAA,CAAA,EAAA,gBAAA,SAAA,EAAA,CAAA,CAAA;;MAEX,IAAI,WAAM;AACR,cAAC;QAAA,gBAAqB,MAAQ;SAC/B,IAAA,OAAA;;;SAGC,IAAI,WAAA;AACH,iBAAA;WAAA,gBAAA,gBAAA;YACE,SAAA;YACC,MAAA;YACE,MAAA;YACA,aAAW,IAAA;YACZ,CAAC;WAAE,gBAAW,OAAA,EAAA,CAAA;WAAA,gBAAA,eAAA;YACb,UAAG,EAAS;YACZ,IAAG,WAAU;AACX,oBAAO,OAAC,YAAA,EAAA;;YAEX,CAAC;WAAC,gBAAA,OAAA,EAAA,CAAA;WAAA;;SAEN,CAAC;QAAE,gBAAC,SAAA,EAAA,CAAA;QAAA,IAAA;QAAA,gBAAA,SAAA,EAAA,CAAA;QAAA,IAAA;QAAA;;MAER,CAAC,EAAE,gBAAO,MAAA;MACT,IAAI,OAAO;AACT,cAAO,OAAE,OAAS,OAAA,SAAA,CAAA,SAAA;;MAEpB,IAAI,WAAG;AACL,cAAK,gBAAkB,KAAK;QAC1B,IAAI,OAAC;AACH,gBAAI,OAAA,OAAA,OAAA,SAAA;;QAEN,gBAAY;QACZ,WAAM,UAAa,gBAAgB,MAAA;SACjC,IAAG,OAAA;AACD,iBAAM,MAAA;;SAER,IAAG,WAAK;AACN,iBAAI,gBAAA,cAAA,EACL,SAAS,OACT,CAAA;;SAED,IAAC,WAAY;AACb,iBAAQ,gBAAA,qBAAA,EACJ,SAAM,OACT,CAAG;;SAEL,CAAC;QACH,CAAC;;MAEL,CAAC,CAAC,CAAC;;IAEP;GACF;EAAC"}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_kebab_case = require('../node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.cjs');
|
|
3
|
+
const require_snake_case = require('../node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.cjs');
|
|
4
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
6
|
+
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
7
|
+
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
8
|
+
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
9
|
+
let _shell_shock_core = require("@shell-shock/core");
|
|
10
|
+
let _shell_shock_plugin_theme_contexts_theme = require("@shell-shock/plugin-theme/contexts/theme");
|
|
11
|
+
|
|
12
|
+
//#region ../plugin-help/dist/components/display.mjs
|
|
13
|
+
/**
|
|
14
|
+
* A component that generates the usage display for a command.
|
|
15
|
+
*/
|
|
16
|
+
function HelpUsageDisplay(props) {
|
|
17
|
+
const { command, indent = 2 } = props;
|
|
18
|
+
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
19
|
+
const theme = (0, _shell_shock_plugin_theme_contexts_theme.useTheme)();
|
|
20
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
21
|
+
get each() {
|
|
22
|
+
return Object.keys(context.config.bin);
|
|
23
|
+
},
|
|
24
|
+
hardline: true,
|
|
25
|
+
children: (bin) => [(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`
|
|
26
|
+
writeLine(
|
|
27
|
+
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} }
|
|
28
|
+
);`), (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})]
|
|
29
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
30
|
+
get when() {
|
|
31
|
+
return command.args.length > 0;
|
|
32
|
+
},
|
|
33
|
+
get children() {
|
|
34
|
+
return [(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
35
|
+
get each() {
|
|
36
|
+
return Object.keys(context.config.bin);
|
|
37
|
+
},
|
|
38
|
+
hardline: true,
|
|
39
|
+
children: (bin) => [(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`
|
|
40
|
+
writeLine(
|
|
41
|
+
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} }
|
|
42
|
+
);`), (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})]
|
|
43
|
+
})];
|
|
44
|
+
}
|
|
45
|
+
})];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A component that generates the options table display for a command.
|
|
49
|
+
*/
|
|
50
|
+
function HelpOptionsDisplay(props) {
|
|
51
|
+
const { options } = props;
|
|
52
|
+
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
53
|
+
return [
|
|
54
|
+
_alloy_js_core.code`table([ `,
|
|
55
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
56
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
57
|
+
get each() {
|
|
58
|
+
return (0, _shell_shock_core_plugin_utils.sortOptions)(options);
|
|
59
|
+
},
|
|
60
|
+
hardline: true,
|
|
61
|
+
children: (option) => {
|
|
62
|
+
const flags = [];
|
|
63
|
+
const names = [];
|
|
64
|
+
if (option.name.length === 1) flags.push(`-${option.name}`);
|
|
65
|
+
else names.push(`--${require_kebab_case.kebabCase(option.name)}`);
|
|
66
|
+
option.alias.forEach((alias) => {
|
|
67
|
+
if (alias.length === 1) flags.push(`-${alias}`);
|
|
68
|
+
else names.push(`--${require_kebab_case.kebabCase(alias)}`);
|
|
69
|
+
});
|
|
70
|
+
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" }], `;
|
|
71
|
+
}
|
|
72
|
+
}),
|
|
73
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
74
|
+
_alloy_js_core.code` ]); `
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A component that generates the commands table display for a command.
|
|
79
|
+
*/
|
|
80
|
+
function HelpCommandsDisplay(props) {
|
|
81
|
+
const { commands } = props;
|
|
82
|
+
return [
|
|
83
|
+
_alloy_js_core.code`table([ `,
|
|
84
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
85
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
86
|
+
get each() {
|
|
87
|
+
return Object.values(commands);
|
|
88
|
+
},
|
|
89
|
+
hardline: true,
|
|
90
|
+
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" }], `
|
|
91
|
+
}),
|
|
92
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
93
|
+
_alloy_js_core.code` ]); `
|
|
94
|
+
];
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* A component that generates the `help` function declaration for a command.
|
|
98
|
+
*/
|
|
99
|
+
function BaseHelpDisplay(props) {
|
|
100
|
+
const { command, indent = 1, filterGlobalOptions = false } = props;
|
|
101
|
+
const theme = (0, _shell_shock_plugin_theme_contexts_theme.useTheme)();
|
|
102
|
+
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
103
|
+
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));
|
|
104
|
+
return [
|
|
105
|
+
(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} }` : ""});`),
|
|
106
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
107
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(HelpUsageDisplay, {
|
|
108
|
+
command,
|
|
109
|
+
indent
|
|
110
|
+
}),
|
|
111
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
112
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
113
|
+
get when() {
|
|
114
|
+
return options.value.length > 0;
|
|
115
|
+
},
|
|
116
|
+
get children() {
|
|
117
|
+
return [
|
|
118
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`writeLine("");
|
|
119
|
+
writeLine(colors.bold(colors.text.heading.secondary("Options:"))${indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : ""});`),
|
|
120
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
121
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(HelpOptionsDisplay, { get options() {
|
|
122
|
+
return options.value;
|
|
123
|
+
} }),
|
|
124
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
|
|
125
|
+
];
|
|
126
|
+
}
|
|
127
|
+
}),
|
|
128
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
129
|
+
get when() {
|
|
130
|
+
return Object.keys(command.children).length > 0;
|
|
131
|
+
},
|
|
132
|
+
get children() {
|
|
133
|
+
return [
|
|
134
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`writeLine("");
|
|
135
|
+
writeLine(colors.bold(colors.text.heading.secondary("Commands:"))${indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : ""});`),
|
|
136
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
137
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(HelpCommandsDisplay, { get commands() {
|
|
138
|
+
return command.children;
|
|
139
|
+
} }),
|
|
140
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
|
|
141
|
+
];
|
|
142
|
+
}
|
|
143
|
+
})
|
|
144
|
+
];
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* A component that generates the invocation of the `help` function for a command.
|
|
148
|
+
*/
|
|
149
|
+
function VirtualCommandHelpDisplay(props) {
|
|
150
|
+
const { options, segments, commands } = props;
|
|
151
|
+
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
152
|
+
return [
|
|
153
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
154
|
+
_alloy_js_core.code`writeLine(colors.bold(colors.text.heading.secondary("Global Options:")));`,
|
|
155
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
156
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(HelpOptionsDisplay, { options }),
|
|
157
|
+
_alloy_js_core.code`writeLine(""); `,
|
|
158
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
159
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
160
|
+
get when() {
|
|
161
|
+
return Object.keys(commands).length > 0;
|
|
162
|
+
},
|
|
163
|
+
get children() {
|
|
164
|
+
return [
|
|
165
|
+
(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:"));
|
|
166
|
+
writeLine(""); `),
|
|
167
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
168
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
169
|
+
get each() {
|
|
170
|
+
return Object.values(commands);
|
|
171
|
+
},
|
|
172
|
+
doubleHardline: true,
|
|
173
|
+
joiner: _alloy_js_core.code`writeLine(""); `,
|
|
174
|
+
ender: _alloy_js_core.code`writeLine(""); `,
|
|
175
|
+
children: (child) => [
|
|
176
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`
|
|
177
|
+
writeLine(colors.text.heading.primary(${child.icon ? `(isUnicodeSupported ? " ${child.icon} " : "") + ` : ""}"${child.title} ${child.isVirtual ? "" : "Command"}"));
|
|
178
|
+
writeLine("");
|
|
179
|
+
writeLine(colors.text.body.secondary(splitText(\`${(0, _shell_shock_core_plugin_utils.formatDescription)(child.description).replace(/\.+$/, "").trim()}.\`)));
|
|
180
|
+
writeLine("");
|
|
181
|
+
`),
|
|
182
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
183
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(BaseHelpDisplay, {
|
|
184
|
+
command: child,
|
|
185
|
+
indent: 2,
|
|
186
|
+
filterGlobalOptions: true
|
|
187
|
+
}),
|
|
188
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
189
|
+
]
|
|
190
|
+
}),
|
|
191
|
+
(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.");
|
|
192
|
+
writeLine("");`)
|
|
193
|
+
];
|
|
194
|
+
}
|
|
195
|
+
})
|
|
196
|
+
];
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* A component that generates the invocation of the `help` function for a command.
|
|
200
|
+
*/
|
|
201
|
+
function CommandHelpDisplay(props) {
|
|
202
|
+
const { command } = props;
|
|
203
|
+
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
204
|
+
return [
|
|
205
|
+
_alloy_js_core.code`writeLine(""); `,
|
|
206
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
207
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(BaseHelpDisplay, {
|
|
208
|
+
command,
|
|
209
|
+
filterGlobalOptions: false
|
|
210
|
+
}),
|
|
211
|
+
_alloy_js_core.code`writeLine(""); `,
|
|
212
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
213
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
214
|
+
get when() {
|
|
215
|
+
return Object.keys(command.children).length > 0;
|
|
216
|
+
},
|
|
217
|
+
get children() {
|
|
218
|
+
return [
|
|
219
|
+
_alloy_js_core.code`writeLine(colors.text.body.secondary("The following sub-commands are available:"));
|
|
220
|
+
writeLine(""); `,
|
|
221
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
222
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
223
|
+
get each() {
|
|
224
|
+
return Object.values(command.children);
|
|
225
|
+
},
|
|
226
|
+
doubleHardline: true,
|
|
227
|
+
joiner: _alloy_js_core.code`writeLine(""); `,
|
|
228
|
+
ender: _alloy_js_core.code`writeLine(""); `,
|
|
229
|
+
children: (child) => [
|
|
230
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`
|
|
231
|
+
writeLine(colors.text.heading.primary(${child.icon ? `(isUnicodeSupported ? " ${child.icon} " : "") + ` : ""}"${child.title} ${child.isVirtual ? "" : "Command"}"));
|
|
232
|
+
writeLine("");
|
|
233
|
+
writeLine(colors.text.body.secondary(splitText(\`${(0, _shell_shock_core_plugin_utils.formatDescription)(child.description).replace(/\.+$/, "").trim()}.\`)));
|
|
234
|
+
writeLine("");
|
|
235
|
+
`),
|
|
236
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
237
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(BaseHelpDisplay, {
|
|
238
|
+
command: child,
|
|
239
|
+
indent: 2,
|
|
240
|
+
filterGlobalOptions: true
|
|
241
|
+
}),
|
|
242
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
243
|
+
]
|
|
244
|
+
}),
|
|
245
|
+
(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.");
|
|
246
|
+
writeLine("");`)
|
|
247
|
+
];
|
|
248
|
+
}
|
|
249
|
+
})
|
|
250
|
+
];
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
//#endregion
|
|
254
|
+
exports.BaseHelpDisplay = BaseHelpDisplay;
|
|
255
|
+
exports.CommandHelpDisplay = CommandHelpDisplay;
|
|
256
|
+
exports.HelpCommandsDisplay = HelpCommandsDisplay;
|
|
257
|
+
exports.HelpOptionsDisplay = HelpOptionsDisplay;
|
|
258
|
+
exports.HelpUsageDisplay = HelpUsageDisplay;
|
|
259
|
+
exports.VirtualCommandHelpDisplay = VirtualCommandHelpDisplay;
|
|
260
|
+
//# sourceMappingURL=display.cjs.map
|