@shell-shock/preset-script 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/components/args-parser-logic.cjs +678 -0
- package/dist/components/args-parser-logic.cjs.map +1 -0
- package/dist/components/args-parser-logic.d.cts +45 -0
- package/dist/components/args-parser-logic.d.cts.map +1 -0
- package/dist/components/args-parser-logic.d.mts +45 -0
- package/dist/components/args-parser-logic.d.mts.map +1 -0
- package/dist/components/args-parser-logic.mjs +672 -0
- package/dist/components/args-parser-logic.mjs.map +1 -0
- package/dist/components/bin-entry.cjs +188 -0
- package/dist/components/bin-entry.cjs.map +1 -0
- package/dist/components/{entry/bin.d.cts → bin-entry.d.cts} +9 -3
- package/dist/components/bin-entry.d.cts.map +1 -0
- package/dist/components/{entry/bin.d.mts → bin-entry.d.mts} +9 -3
- package/dist/components/bin-entry.d.mts.map +1 -0
- package/dist/components/bin-entry.mjs +185 -0
- package/dist/components/bin-entry.mjs.map +1 -0
- package/dist/components/command-entry.cjs +162 -0
- package/dist/components/command-entry.cjs.map +1 -0
- package/dist/components/command-entry.d.cts +24 -0
- package/dist/components/command-entry.d.cts.map +1 -0
- package/dist/components/command-entry.d.mts +24 -0
- package/dist/components/command-entry.d.mts.map +1 -0
- package/dist/components/command-entry.mjs +158 -0
- package/dist/components/command-entry.mjs.map +1 -0
- package/dist/components/command-router.cjs +129 -74
- package/dist/components/command-router.cjs.map +1 -1
- package/dist/components/command-router.d.cts +13 -4
- package/dist/components/command-router.d.cts.map +1 -0
- package/dist/components/command-router.d.mts +13 -4
- package/dist/components/command-router.d.mts.map +1 -0
- package/dist/components/command-router.mjs +128 -73
- package/dist/components/command-router.mjs.map +1 -1
- package/dist/components/console-builtin.cjs +2086 -0
- package/dist/components/console-builtin.cjs.map +1 -0
- package/dist/components/console-builtin.d.cts +56 -0
- package/dist/components/console-builtin.d.cts.map +1 -0
- package/dist/components/console-builtin.d.mts +56 -0
- package/dist/components/console-builtin.d.mts.map +1 -0
- package/dist/components/console-builtin.mjs +2077 -0
- package/dist/components/console-builtin.mjs.map +1 -0
- package/dist/components/help.cjs +130 -0
- package/dist/components/help.cjs.map +1 -0
- package/dist/components/help.d.cts +57 -0
- package/dist/components/help.d.cts.map +1 -0
- package/dist/components/help.d.mts +57 -0
- package/dist/components/help.d.mts.map +1 -0
- package/dist/components/help.mjs +126 -0
- package/dist/components/help.mjs.map +1 -0
- package/dist/components/index.cjs +39 -15
- package/dist/components/index.d.cts +9 -7
- package/dist/components/index.d.mts +9 -7
- package/dist/components/index.mjs +8 -6
- package/dist/components/utils-builtin.cjs +612 -0
- package/dist/components/utils-builtin.cjs.map +1 -0
- package/dist/components/utils-builtin.d.cts +32 -0
- package/dist/components/utils-builtin.d.cts.map +1 -0
- package/dist/components/utils-builtin.d.mts +32 -0
- package/dist/components/utils-builtin.d.mts.map +1 -0
- package/dist/components/utils-builtin.mjs +605 -0
- package/dist/components/utils-builtin.mjs.map +1 -0
- package/dist/components/virtual-command-entry.cjs +140 -0
- package/dist/components/virtual-command-entry.cjs.map +1 -0
- package/dist/components/virtual-command-entry.d.cts +21 -0
- package/dist/components/virtual-command-entry.d.cts.map +1 -0
- package/dist/components/virtual-command-entry.d.mts +21 -0
- package/dist/components/virtual-command-entry.d.mts.map +1 -0
- package/dist/components/virtual-command-entry.mjs +137 -0
- package/dist/components/virtual-command-entry.mjs.map +1 -0
- package/dist/contexts/index.cjs +4 -0
- package/dist/contexts/index.d.cts +2 -0
- package/dist/contexts/index.d.mts +2 -0
- package/dist/contexts/index.mjs +3 -0
- package/dist/contexts/theme.d.cts +20 -0
- package/dist/contexts/theme.d.cts.map +1 -0
- package/dist/contexts/theme.d.mts +20 -0
- package/dist/contexts/theme.d.mts.map +1 -0
- package/dist/helpers/ansi-utils.cjs +28 -4
- package/dist/helpers/ansi-utils.cjs.map +1 -1
- package/dist/helpers/ansi-utils.d.cts +68 -0
- package/dist/helpers/ansi-utils.d.cts.map +1 -0
- package/dist/helpers/ansi-utils.d.mts +68 -0
- package/dist/helpers/ansi-utils.d.mts.map +1 -0
- package/dist/helpers/ansi-utils.mjs +28 -4
- package/dist/helpers/ansi-utils.mjs.map +1 -1
- package/dist/helpers/get-default-options.cjs +6 -13
- package/dist/helpers/get-default-options.cjs.map +1 -1
- package/dist/helpers/get-default-options.mjs +6 -13
- package/dist/helpers/get-default-options.mjs.map +1 -1
- package/dist/index.cjs +117 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +118 -28
- package/dist/index.mjs.map +1 -1
- package/dist/types/plugin.d.cts +1 -6
- package/dist/types/plugin.d.cts.map +1 -0
- package/dist/types/plugin.d.mts +1 -6
- package/dist/types/plugin.d.mts.map +1 -0
- package/package.json +163 -71
- package/dist/components/builtin/console.cjs +0 -1232
- package/dist/components/builtin/console.cjs.map +0 -1
- package/dist/components/builtin/console.d.cts +0 -37
- package/dist/components/builtin/console.d.mts +0 -37
- package/dist/components/builtin/console.mjs +0 -1225
- package/dist/components/builtin/console.mjs.map +0 -1
- package/dist/components/builtin/index.cjs +0 -9
- package/dist/components/builtin/index.d.cts +0 -2
- package/dist/components/builtin/index.d.mts +0 -2
- package/dist/components/builtin/index.mjs +0 -3
- package/dist/components/entry/bin.cjs +0 -92
- package/dist/components/entry/bin.cjs.map +0 -1
- package/dist/components/entry/bin.mjs +0 -91
- package/dist/components/entry/bin.mjs.map +0 -1
- package/dist/components/entry/command.cjs +0 -54
- package/dist/components/entry/command.cjs.map +0 -1
- package/dist/components/entry/command.d.cts +0 -15
- package/dist/components/entry/command.d.mts +0 -15
- package/dist/components/entry/command.mjs +0 -53
- package/dist/components/entry/command.mjs.map +0 -1
- package/dist/components/entry/index.cjs +0 -3
- package/dist/components/entry/index.d.cts +0 -2
- package/dist/components/entry/index.d.mts +0 -2
- package/dist/components/entry/index.mjs +0 -3
- package/dist/components/shutdown.cjs +0 -93
- package/dist/components/shutdown.cjs.map +0 -1
- package/dist/components/shutdown.d.cts +0 -14
- package/dist/components/shutdown.d.mts +0 -14
- package/dist/components/shutdown.mjs +0 -91
- package/dist/components/shutdown.mjs.map +0 -1
- package/dist/contexts/command.cjs +0 -21
- package/dist/contexts/command.cjs.map +0 -1
- package/dist/contexts/command.mjs +0 -19
- package/dist/contexts/command.mjs.map +0 -1
|
@@ -4,16 +4,15 @@ import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
|
|
|
4
4
|
/**
|
|
5
5
|
* Get the default command options.
|
|
6
6
|
*
|
|
7
|
-
* @param context - The build context.
|
|
8
|
-
* @param command - The command input.
|
|
9
7
|
* @returns The default command options.
|
|
10
8
|
*/
|
|
11
|
-
function getDefaultOptions(
|
|
9
|
+
function getDefaultOptions() {
|
|
12
10
|
return [
|
|
13
11
|
{
|
|
14
12
|
name: "help",
|
|
15
13
|
title: "Help",
|
|
16
14
|
description: "Show help information.",
|
|
15
|
+
env: false,
|
|
17
16
|
alias: ["h", "?"],
|
|
18
17
|
kind: ReflectionKind.boolean,
|
|
19
18
|
optional: true,
|
|
@@ -24,6 +23,7 @@ function getDefaultOptions(context, command) {
|
|
|
24
23
|
name: "version",
|
|
25
24
|
title: "Version",
|
|
26
25
|
description: "Show the version of the application.",
|
|
26
|
+
env: false,
|
|
27
27
|
alias: ["v"],
|
|
28
28
|
kind: ReflectionKind.boolean,
|
|
29
29
|
optional: true,
|
|
@@ -31,24 +31,17 @@ function getDefaultOptions(context, command) {
|
|
|
31
31
|
skipAddingNegative: true
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
|
-
name: "no-banner",
|
|
35
|
-
title: "Hide Banner",
|
|
36
|
-
description: "Hide the banner displayed while running the CLI application (will be set to true if running in a CI pipeline).",
|
|
37
|
-
kind: ReflectionKind.boolean,
|
|
38
|
-
optional: true,
|
|
39
|
-
default: false,
|
|
40
|
-
isNegativeOf: "banner"
|
|
41
|
-
},
|
|
42
|
-
!command.isVirtual && {
|
|
43
34
|
name: "verbose",
|
|
44
35
|
title: "Verbose",
|
|
45
36
|
description: "Enable verbose output.",
|
|
37
|
+
env: "VERBOSE",
|
|
38
|
+
alias: ["V"],
|
|
46
39
|
kind: ReflectionKind.boolean,
|
|
47
40
|
optional: true,
|
|
48
41
|
default: false,
|
|
49
42
|
skipAddingNegative: true
|
|
50
43
|
}
|
|
51
|
-
]
|
|
44
|
+
];
|
|
52
45
|
}
|
|
53
46
|
|
|
54
47
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-default-options.mjs","names":["ReflectionKind","getDefaultOptions","
|
|
1
|
+
{"version":3,"file":"get-default-options.mjs","names":["ReflectionKind","getDefaultOptions","name","title","description","env","alias","kind","boolean","optional","default","skipAddingNegative"],"sources":["../../src/helpers/get-default-options.ts"],"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 { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport type { CommandOption } from \"@shell-shock/core\";\n\n/**\n * Get the default command options.\n *\n * @returns The default command options.\n */\nexport function getDefaultOptions(): CommandOption[] {\n return [\n {\n name: \"help\",\n title: \"Help\",\n description: \"Show help information.\",\n env: false,\n alias: [\"h\", \"?\"],\n kind: ReflectionKind.boolean,\n optional: true,\n default: false,\n skipAddingNegative: true\n },\n {\n name: \"version\",\n title: \"Version\",\n description: \"Show the version of the application.\",\n env: false,\n alias: [\"v\"],\n kind: ReflectionKind.boolean,\n optional: true,\n default: false,\n skipAddingNegative: true\n },\n {\n name: \"verbose\",\n title: \"Verbose\",\n description: \"Enable verbose output.\",\n env: \"VERBOSE\",\n alias: [\"V\"],\n kind: ReflectionKind.boolean,\n optional: true,\n default: false,\n skipAddingNegative: true\n }\n ];\n}\n"],"mappings":";;;;;;;;AA0BA,SAAgBC,oBAAqC;AACnD,QAAO;EACL;GACEC,MAAM;GACNC,OAAO;GACPC,aAAa;GACbC,KAAK;GACLC,OAAO,CAAC,KAAK,IAAI;GACjBC,MAAMP,eAAeQ;GACrBC,UAAU;GACVC,SAAS;GACTC,oBAAoB;GACrB;EACD;GACET,MAAM;GACNC,OAAO;GACPC,aAAa;GACbC,KAAK;GACLC,OAAO,CAAC,IAAI;GACZC,MAAMP,eAAeQ;GACrBC,UAAU;GACVC,SAAS;GACTC,oBAAoB;GACrB;EACD;GACET,MAAM;GACNC,OAAO;GACPC,aAAa;GACbC,KAAK;GACLC,OAAO,CAAC,IAAI;GACZC,MAAMP,eAAeQ;GACrBC,UAAU;GACVC,SAAS;GACTC,oBAAoB;GACrB;EACF"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
3
|
+
const require_components_bin_entry = require('./components/bin-entry.cjs');
|
|
4
|
+
const require_components_help = require('./components/help.cjs');
|
|
5
|
+
const require_components_command_router = require('./components/command-router.cjs');
|
|
6
|
+
const require_components_virtual_command_entry = require('./components/virtual-command-entry.cjs');
|
|
7
|
+
const require_components_command_entry = require('./components/command-entry.cjs');
|
|
8
|
+
const require_components_console_builtin = require('./components/console-builtin.cjs');
|
|
9
|
+
const require_components_utils_builtin = require('./components/utils-builtin.cjs');
|
|
7
10
|
const require_get_default_options = require('./helpers/get-default-options.cjs');
|
|
8
11
|
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
9
|
-
let
|
|
10
|
-
let
|
|
11
|
-
|
|
12
|
-
let __shell_shock_core_components_utils_builtin = require("@shell-shock/core/components/utils-builtin");
|
|
12
|
+
let __alloy_js_core = require("@alloy-js/core");
|
|
13
|
+
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
14
|
+
let __powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
|
|
13
15
|
let __shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
14
|
-
let
|
|
15
|
-
__shell_shock_core_powerlines = require_rolldown_runtime.__toESM(__shell_shock_core_powerlines);
|
|
16
|
+
let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
|
|
16
17
|
let __shell_shock_plugin_theme = require("@shell-shock/plugin-theme");
|
|
17
18
|
__shell_shock_plugin_theme = require_rolldown_runtime.__toESM(__shell_shock_plugin_theme);
|
|
18
19
|
|
|
@@ -22,37 +23,124 @@ __shell_shock_plugin_theme = require_rolldown_runtime.__toESM(__shell_shock_plug
|
|
|
22
23
|
*/
|
|
23
24
|
const plugin = (options = {}) => {
|
|
24
25
|
return [
|
|
25
|
-
...(0, __shell_shock_core_powerlines.default)(options),
|
|
26
|
-
(0, __powerlines_plugin_nodejs.default)(options),
|
|
27
26
|
(0, __shell_shock_plugin_theme.default)({ theme: options.theme }),
|
|
28
27
|
{
|
|
29
28
|
name: "shell-shock:script-preset",
|
|
30
29
|
config() {
|
|
31
|
-
this.
|
|
30
|
+
this.debug("Providing default configuration for the Shell Shock `script` preset.");
|
|
32
31
|
return {
|
|
33
32
|
defaultOptions: require_get_default_options.getDefaultOptions,
|
|
33
|
+
isCaseSensitive: false,
|
|
34
34
|
...options
|
|
35
35
|
};
|
|
36
36
|
},
|
|
37
|
+
configResolved() {
|
|
38
|
+
this.dependencies.didyoumean2 = "^7.0.4";
|
|
39
|
+
},
|
|
37
40
|
async prepare() {
|
|
38
|
-
this.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
this.debug("Rendering built-in modules for the Shell Shock `script` preset.");
|
|
42
|
+
return (0, __powerlines_plugin_alloy_render.render)(this, [(0, __alloy_js_core_jsx_runtime.createComponent)(require_components_utils_builtin.UtilsBuiltin, {}), (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_console_builtin.ConsoleBuiltin, {})]);
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "shell-shock:script-preset:generate-entrypoint",
|
|
47
|
+
prepare: {
|
|
48
|
+
order: "post",
|
|
49
|
+
async handler() {
|
|
50
|
+
const _self$ = this;
|
|
51
|
+
this.debug("Rendering entrypoint modules for the Shell Shock `script` preset.");
|
|
52
|
+
const commands = this.inputs.map((input) => (0, __shell_shock_core_plugin_utils.getCommandTree)(this, input.path.segments)).filter(Boolean);
|
|
53
|
+
return (0, __powerlines_plugin_alloy_render.render)(this, [(0, __alloy_js_core_jsx_runtime.createComponent)(require_components_bin_entry.BinEntry, {
|
|
54
|
+
builtinImports: {
|
|
55
|
+
console: [
|
|
56
|
+
"divider",
|
|
57
|
+
"writeLine",
|
|
58
|
+
"colors"
|
|
59
|
+
],
|
|
60
|
+
utils: ["getArgs"]
|
|
44
61
|
},
|
|
45
|
-
get
|
|
46
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(
|
|
62
|
+
get children() {
|
|
63
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
64
|
+
get when() {
|
|
65
|
+
return (0, __alloy_js_core_jsx_runtime.memo)(() => !!_self$.commands)() && Object.keys(_self$.commands).length > 0;
|
|
66
|
+
},
|
|
67
|
+
get children() {
|
|
68
|
+
return [
|
|
69
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
70
|
+
"const": true,
|
|
71
|
+
name: "args",
|
|
72
|
+
type: "string[]",
|
|
73
|
+
initializer: __alloy_js_core.code`getArgs();`
|
|
74
|
+
}),
|
|
75
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
76
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(require_components_command_router.CommandRouter, {
|
|
77
|
+
path: [],
|
|
78
|
+
get commands() {
|
|
79
|
+
return _self$.commands ?? {};
|
|
80
|
+
}
|
|
81
|
+
}),
|
|
82
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
83
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
84
|
+
(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`
|
|
85
|
+
writeLine("");
|
|
86
|
+
writeLine(colors.text.heading.primary("${/(?:cli|command-line|command line)\s+(?:application|app)?$/.test((0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(_self$).toLowerCase()) ? (0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(_self$) : `${(0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(_self$)} Command-Line Application`} v${_self$.packageJson.version}"));
|
|
87
|
+
writeLine("");
|
|
88
|
+
writeLine(colors.text.body.primary("${(0, __shell_shock_core_plugin_utils_context_helpers.getAppDescription)(_self$)}"));
|
|
89
|
+
writeLine("");
|
|
90
|
+
divider({ style: "primary" });
|
|
91
|
+
writeLine("");
|
|
92
|
+
writeLine("");`),
|
|
93
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
94
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
95
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
96
|
+
get each() {
|
|
97
|
+
return Object.values(commands);
|
|
98
|
+
},
|
|
99
|
+
doubleHardline: true,
|
|
100
|
+
joiner: __alloy_js_core.code`
|
|
101
|
+
writeLine("");
|
|
102
|
+
divider({ style: "secondary" });
|
|
103
|
+
writeLine("");
|
|
104
|
+
writeLine("");
|
|
105
|
+
`,
|
|
106
|
+
children: (child) => [
|
|
107
|
+
(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`
|
|
108
|
+
writeLine("");
|
|
109
|
+
writeLine(colors.text.heading.secondary("${child.title}"));
|
|
110
|
+
writeLine("");
|
|
111
|
+
writeLine(colors.text.body.secondary("${child.description}"));
|
|
112
|
+
writeLine("");
|
|
113
|
+
writeLine("");
|
|
114
|
+
`),
|
|
115
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
116
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(require_components_help.Help, {
|
|
117
|
+
command: child,
|
|
118
|
+
indent: 2
|
|
119
|
+
})
|
|
120
|
+
]
|
|
121
|
+
})
|
|
122
|
+
];
|
|
123
|
+
}
|
|
124
|
+
});
|
|
47
125
|
}
|
|
48
|
-
}),
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
126
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
127
|
+
get each() {
|
|
128
|
+
return Object.values(commands);
|
|
129
|
+
},
|
|
130
|
+
doubleHardline: true,
|
|
131
|
+
children: (child) => (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
132
|
+
get when() {
|
|
133
|
+
return child.isVirtual;
|
|
134
|
+
},
|
|
135
|
+
get fallback() {
|
|
136
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_command_entry.CommandEntry, { command: child });
|
|
137
|
+
},
|
|
138
|
+
get children() {
|
|
139
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_virtual_command_entry.VirtualCommandEntry, { command: child });
|
|
140
|
+
}
|
|
141
|
+
})
|
|
142
|
+
})]);
|
|
143
|
+
}
|
|
56
144
|
}
|
|
57
145
|
}
|
|
58
146
|
];
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["For","
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["code","For","Show","VarDeclaration","render","getCommandTree","getAppDescription","getAppTitle","theme","BinEntry","CommandEntry","CommandRouter","ConsoleBuiltin","Help","UtilsBuiltin","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","_$createComponent","order","handler","_self$","commands","inputs","map","input","path","segments","filter","Boolean","builtinImports","console","utils","children","when","_$memo","Object","keys","length","type","initializer","_$createIntrinsic","test","toLowerCase","packageJson","version","each","values","doubleHardline","joiner","child","title","description","command","indent","isVirtual","fallback"],"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 { render } from \"@powerlines/plugin-alloy/render\";\nimport { getCommandTree } from \"@shell-shock/core/plugin-utils\";\nimport {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport theme from \"@shell-shock/plugin-theme\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { ConsoleBuiltin } from \"./components/console-builtin\";\nimport { Help } from \"./components/help\";\nimport { UtilsBuiltin } from \"./components/utils-builtin\";\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 theme({\n theme: options.theme\n }),\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 configResolved() {\n this.dependencies.didyoumean2 = \"^7.0.4\";\n },\n async prepare() {\n this.debug(\n \"Rendering built-in modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <UtilsBuiltin />\n <ConsoleBuiltin />\n </>\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 const commands = this.inputs\n .map(input => getCommandTree(this, input.path.segments))\n .filter(Boolean) as CommandTree[];\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\"divider\", \"writeLine\", \"colors\"],\n utils: [\"getArgs\"]\n }}>\n <Show\n when={this.commands && Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`getArgs();`}\n />\n <hbr />\n <CommandRouter path={[]} commands={this.commands ?? {}} />\n <hbr />\n <hbr />\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.primary(\"${\n /(?:cli|command-line|command line)\\s+(?:application|app)?$/.test(\n getAppTitle(this).toLowerCase()\n )\n ? getAppTitle(this)\n : `${getAppTitle(this)} Command-Line Application`\n } v${this.packageJson.version}\"));\n writeLine(\"\");\n writeLine(colors.text.body.primary(\"${getAppDescription(\n this\n )}\"));\n writeLine(\"\");\n divider({ style: \"primary\" });\n writeLine(\"\");\n writeLine(\"\");`}\n <hbr />\n <hbr />\n <For\n each={Object.values(commands)}\n doubleHardline\n joiner={code`\n writeLine(\"\");\n divider({ style: \"secondary\" });\n writeLine(\"\");\n writeLine(\"\");\n `}>\n {child => (\n <>\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.secondary(\"${child.title}\"));\n writeLine(\"\");\n writeLine(colors.text.body.secondary(\"${child.description}\"));\n writeLine(\"\");\n writeLine(\"\");\n `}\n <hbr />\n <Help command={child} indent={2} />\n </>\n )}\n </For>\n </Show>\n </BinEntry>\n <For each={Object.values(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 </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAaiB,UAGXC,UAA+B,EAAE,KAC9B;AACH,QAAO;0CACC,EACJV,OAAOU,QAAQV,OAChB,CAAC;EACF;GACEW,MAAM;GACNC,SAAS;AACP,SAAKC,MACH,uEACD;AAED,WAAO;KACLC,gBAAgBN;KAChBO,iBAAiB;KACjB,GAAGL;KACJ;;GAEHM,iBAAiB;AACf,SAAKC,aAAaC,cAAc;;GAElC,MAAMC,UAAU;AACd,SAAKN,MACH,kEACD;AAED,wDACE,MAAI,kDAEDP,+CAAY,EAAA,CAAA,mDACZF,mDAAc,EAAA,CAAA,CAEnB,CAAC;;GAEJ;EACD;GACEO,MAAM;GACNQ,SAAS;IACPE,OAAO;IACP,MAAMC,UAAU;KAAA,MAAAC,SAAA;AACd,UAAKV,MACH,oEACD;KAED,MAAMW,WAAW,KAAKC,OACnBC,KAAIC,8DAAwB,MAAMA,MAAMC,KAAKC,SAAS,CAAC,CACvDC,OAAOC,QAAyB;AAEnC,yDACE,MAAI,kDAED9B,uCAAQ;MACP+B,gBAAgB;OACdC,SAAS;QAAC;QAAW;QAAa;QAAS;OAC3CC,OAAO,CAAC,UAAS;OAClB;MAAA,IAAAC,WAAA;AAAA,+DACAzC,sBAAI;QAAA,IACH0C,OAAI;AAAA,4DAAE,CAAA,CAAAb,OAAKC,SAAQ,EAAA,IAAIc,OAAOC,KAAKhB,OAAKC,SAAS,CAACgB,SAAS;;QAAC,IAAAL,WAAA;AAAA,gBAAA;2DAC3DxC,sCAAc;WAAA,SAAA;WAEbgB,MAAI;WACJ8B,MAAI;WACJC,aAAalD,oBAAI;WAAY,CAAA;2DAAA,OAAA,EAAA,CAAA;2DAG9BW,iDAAa;WAACyB,MAAM,EAAE;WAAA,IAAEJ,WAAQ;AAAA,mBAAED,OAAKC,YAAY,EAAE;;WAAA,CAAA;2DAAA,OAAA,EAAA,CAAA;2DAAA,OAAA,EAAA,CAAA;sDAGrDhC,oBAAI;;yDAGL,4DAA4DoD,sEAC/CrB,OAAM,CAACsB,aACpB,CAAC,oEACctB,OAAM,GACjB,oEAAcA,OAAM,CAAA,2BAA2B,IAChDA,OAAKuB,YAAYC,QAAO;;6HAE0BxB,OAEtD,CAAA;;;;gCAIc;2DAAA,OAAA,EAAA,CAAA;2DAAA,OAAA,EAAA,CAAA;2DAGZ9B,qBAAG;WAAA,IACFuD,OAAI;AAAA,mBAAEV,OAAOW,OAAOzB,SAAS;;WAC7B0B,gBAAc;WACdC,QAAQ3D,oBAAI;;;;;;WAKf2C,WACIiB,UAAK;wDAED5D,oBAAI;;2DAE8B4D,MAAMC,MAAK;;wDAEdD,MAAME,YAAW;;;kBAGxD;6DAAA,OAAA,EAAA,CAAA;6DAEQjD,8BAAI;aAACkD,SAASH;aAAOI,QAAQ;aAAC,CAAA;YAAA;WAElC,CAAA;UAAA;;QAAA,CAAA;;MAAA,CAAA,mDAIN/D,qBAAG;MAAA,IAACuD,OAAI;AAAA,cAAEV,OAAOW,OAAOzB,SAAS;;MAAE0B,gBAAc;MAAAf,WAC/CiB,2DACE1D,sBAAI;OAAA,IACH0C,OAAI;AAAA,eAAEgB,MAAMK;;OAAS,IACrBC,WAAQ;AAAA,gEAAGxD,+CAAY,EAACqD,SAASH,OAAK,CAAA;;OAAA,IAAAjB,WAAA;AAAA,gEACrC5B,8DAAmB,EAACgD,SAASH,OAAK,CAAA;;OAAA,CAAA;MAEtC,CAAA,CAGP,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAe3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AA0CA;AACmB,cADN,MACM,EAAA,CAAA,iBAAA,mBAAA,GAAsB,mBAAtB,CAAA,CAAA,OAAA,CAAA,EAER,mBAFQ,EAAA,GAkIZ,MAlIY,CAkIL,QAlIK,CAAA,EAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AA0CA;AACmB,cADN,MACM,EAAA,CAAA,iBAAA,mBAAA,GAAsB,mBAAtB,CAAA,CAAA,OAAA,CAAA,EAER,mBAFQ,EAAA,GAkIZ,MAlIY,CAkIL,QAlIK,CAAA,EAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { BinEntry } from "./components/bin-entry.mjs";
|
|
2
|
+
import { Help } from "./components/help.mjs";
|
|
3
|
+
import { CommandRouter } from "./components/command-router.mjs";
|
|
4
|
+
import { VirtualCommandEntry } from "./components/virtual-command-entry.mjs";
|
|
5
|
+
import { CommandEntry } from "./components/command-entry.mjs";
|
|
6
|
+
import { ConsoleBuiltin } from "./components/console-builtin.mjs";
|
|
7
|
+
import { UtilsBuiltin } from "./components/utils-builtin.mjs";
|
|
5
8
|
import { getDefaultOptions } from "./helpers/get-default-options.mjs";
|
|
6
|
-
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
7
|
-
import { For } from "@alloy-js/core
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
9
|
+
import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
|
|
10
|
+
import { For, Show, code } from "@alloy-js/core";
|
|
11
|
+
import { VarDeclaration } from "@alloy-js/typescript";
|
|
12
|
+
import { render } from "@powerlines/plugin-alloy/render";
|
|
10
13
|
import { getCommandTree } from "@shell-shock/core/plugin-utils";
|
|
11
|
-
import
|
|
14
|
+
import { getAppDescription, getAppTitle } from "@shell-shock/core/plugin-utils/context-helpers";
|
|
12
15
|
import theme from "@shell-shock/plugin-theme";
|
|
13
16
|
|
|
14
17
|
//#region src/index.tsx
|
|
@@ -17,37 +20,124 @@ import theme from "@shell-shock/plugin-theme";
|
|
|
17
20
|
*/
|
|
18
21
|
const plugin = (options = {}) => {
|
|
19
22
|
return [
|
|
20
|
-
...core(options),
|
|
21
|
-
nodejs(options),
|
|
22
23
|
theme({ theme: options.theme }),
|
|
23
24
|
{
|
|
24
25
|
name: "shell-shock:script-preset",
|
|
25
26
|
config() {
|
|
26
|
-
this.
|
|
27
|
+
this.debug("Providing default configuration for the Shell Shock `script` preset.");
|
|
27
28
|
return {
|
|
28
29
|
defaultOptions: getDefaultOptions,
|
|
30
|
+
isCaseSensitive: false,
|
|
29
31
|
...options
|
|
30
32
|
};
|
|
31
33
|
},
|
|
34
|
+
configResolved() {
|
|
35
|
+
this.dependencies.didyoumean2 = "^7.0.4";
|
|
36
|
+
},
|
|
32
37
|
async prepare() {
|
|
33
|
-
this.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
this.debug("Rendering built-in modules for the Shell Shock `script` preset.");
|
|
39
|
+
return render(this, [createComponent(UtilsBuiltin, {}), createComponent(ConsoleBuiltin, {})]);
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "shell-shock:script-preset:generate-entrypoint",
|
|
44
|
+
prepare: {
|
|
45
|
+
order: "post",
|
|
46
|
+
async handler() {
|
|
47
|
+
const _self$ = this;
|
|
48
|
+
this.debug("Rendering entrypoint modules for the Shell Shock `script` preset.");
|
|
49
|
+
const commands = this.inputs.map((input) => getCommandTree(this, input.path.segments)).filter(Boolean);
|
|
50
|
+
return render(this, [createComponent(BinEntry, {
|
|
51
|
+
builtinImports: {
|
|
52
|
+
console: [
|
|
53
|
+
"divider",
|
|
54
|
+
"writeLine",
|
|
55
|
+
"colors"
|
|
56
|
+
],
|
|
57
|
+
utils: ["getArgs"]
|
|
39
58
|
},
|
|
40
|
-
get
|
|
41
|
-
return createComponent(
|
|
59
|
+
get children() {
|
|
60
|
+
return createComponent(Show, {
|
|
61
|
+
get when() {
|
|
62
|
+
return memo(() => !!_self$.commands)() && Object.keys(_self$.commands).length > 0;
|
|
63
|
+
},
|
|
64
|
+
get children() {
|
|
65
|
+
return [
|
|
66
|
+
createComponent(VarDeclaration, {
|
|
67
|
+
"const": true,
|
|
68
|
+
name: "args",
|
|
69
|
+
type: "string[]",
|
|
70
|
+
initializer: code`getArgs();`
|
|
71
|
+
}),
|
|
72
|
+
createIntrinsic("hbr", {}),
|
|
73
|
+
createComponent(CommandRouter, {
|
|
74
|
+
path: [],
|
|
75
|
+
get commands() {
|
|
76
|
+
return _self$.commands ?? {};
|
|
77
|
+
}
|
|
78
|
+
}),
|
|
79
|
+
createIntrinsic("hbr", {}),
|
|
80
|
+
createIntrinsic("hbr", {}),
|
|
81
|
+
memo(() => code`
|
|
82
|
+
writeLine("");
|
|
83
|
+
writeLine(colors.text.heading.primary("${/(?:cli|command-line|command line)\s+(?:application|app)?$/.test(getAppTitle(_self$).toLowerCase()) ? getAppTitle(_self$) : `${getAppTitle(_self$)} Command-Line Application`} v${_self$.packageJson.version}"));
|
|
84
|
+
writeLine("");
|
|
85
|
+
writeLine(colors.text.body.primary("${getAppDescription(_self$)}"));
|
|
86
|
+
writeLine("");
|
|
87
|
+
divider({ style: "primary" });
|
|
88
|
+
writeLine("");
|
|
89
|
+
writeLine("");`),
|
|
90
|
+
createIntrinsic("hbr", {}),
|
|
91
|
+
createIntrinsic("hbr", {}),
|
|
92
|
+
createComponent(For, {
|
|
93
|
+
get each() {
|
|
94
|
+
return Object.values(commands);
|
|
95
|
+
},
|
|
96
|
+
doubleHardline: true,
|
|
97
|
+
joiner: code`
|
|
98
|
+
writeLine("");
|
|
99
|
+
divider({ style: "secondary" });
|
|
100
|
+
writeLine("");
|
|
101
|
+
writeLine("");
|
|
102
|
+
`,
|
|
103
|
+
children: (child) => [
|
|
104
|
+
memo(() => code`
|
|
105
|
+
writeLine("");
|
|
106
|
+
writeLine(colors.text.heading.secondary("${child.title}"));
|
|
107
|
+
writeLine("");
|
|
108
|
+
writeLine(colors.text.body.secondary("${child.description}"));
|
|
109
|
+
writeLine("");
|
|
110
|
+
writeLine("");
|
|
111
|
+
`),
|
|
112
|
+
createIntrinsic("hbr", {}),
|
|
113
|
+
createComponent(Help, {
|
|
114
|
+
command: child,
|
|
115
|
+
indent: 2
|
|
116
|
+
})
|
|
117
|
+
]
|
|
118
|
+
})
|
|
119
|
+
];
|
|
120
|
+
}
|
|
121
|
+
});
|
|
42
122
|
}
|
|
43
|
-
}),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
123
|
+
}), createComponent(For, {
|
|
124
|
+
get each() {
|
|
125
|
+
return Object.values(commands);
|
|
126
|
+
},
|
|
127
|
+
doubleHardline: true,
|
|
128
|
+
children: (child) => createComponent(Show, {
|
|
129
|
+
get when() {
|
|
130
|
+
return child.isVirtual;
|
|
131
|
+
},
|
|
132
|
+
get fallback() {
|
|
133
|
+
return createComponent(CommandEntry, { command: child });
|
|
134
|
+
},
|
|
135
|
+
get children() {
|
|
136
|
+
return createComponent(VirtualCommandEntry, { command: child });
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
})]);
|
|
140
|
+
}
|
|
51
141
|
}
|
|
52
142
|
}
|
|
53
143
|
];
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["For","
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","getCommandTree","getAppDescription","getAppTitle","theme","BinEntry","CommandEntry","CommandRouter","ConsoleBuiltin","Help","UtilsBuiltin","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","_$createComponent","order","handler","_self$","commands","inputs","map","input","path","segments","filter","Boolean","builtinImports","console","utils","children","when","_$memo","Object","keys","length","type","initializer","_$createIntrinsic","test","toLowerCase","packageJson","version","each","values","doubleHardline","joiner","child","title","description","command","indent","isVirtual","fallback"],"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 { render } from \"@powerlines/plugin-alloy/render\";\nimport { getCommandTree } from \"@shell-shock/core/plugin-utils\";\nimport {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport theme from \"@shell-shock/plugin-theme\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { ConsoleBuiltin } from \"./components/console-builtin\";\nimport { Help } from \"./components/help\";\nimport { UtilsBuiltin } from \"./components/utils-builtin\";\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 theme({\n theme: options.theme\n }),\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 configResolved() {\n this.dependencies.didyoumean2 = \"^7.0.4\";\n },\n async prepare() {\n this.debug(\n \"Rendering built-in modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <UtilsBuiltin />\n <ConsoleBuiltin />\n </>\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 const commands = this.inputs\n .map(input => getCommandTree(this, input.path.segments))\n .filter(Boolean) as CommandTree[];\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\"divider\", \"writeLine\", \"colors\"],\n utils: [\"getArgs\"]\n }}>\n <Show\n when={this.commands && Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`getArgs();`}\n />\n <hbr />\n <CommandRouter path={[]} commands={this.commands ?? {}} />\n <hbr />\n <hbr />\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.primary(\"${\n /(?:cli|command-line|command line)\\s+(?:application|app)?$/.test(\n getAppTitle(this).toLowerCase()\n )\n ? getAppTitle(this)\n : `${getAppTitle(this)} Command-Line Application`\n } v${this.packageJson.version}\"));\n writeLine(\"\");\n writeLine(colors.text.body.primary(\"${getAppDescription(\n this\n )}\"));\n writeLine(\"\");\n divider({ style: \"primary\" });\n writeLine(\"\");\n writeLine(\"\");`}\n <hbr />\n <hbr />\n <For\n each={Object.values(commands)}\n doubleHardline\n joiner={code`\n writeLine(\"\");\n divider({ style: \"secondary\" });\n writeLine(\"\");\n writeLine(\"\");\n `}>\n {child => (\n <>\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.secondary(\"${child.title}\"));\n writeLine(\"\");\n writeLine(colors.text.body.secondary(\"${child.description}\"));\n writeLine(\"\");\n writeLine(\"\");\n `}\n <hbr />\n <Help command={child} indent={2} />\n </>\n )}\n </For>\n </Show>\n </BinEntry>\n <For each={Object.values(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 </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":"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"}
|
package/dist/types/plugin.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommandBase, CommandOption } from "@shell-shock/core/types/command";
|
|
2
|
-
import { AlloyPluginContext
|
|
2
|
+
import { AlloyPluginContext } from "@powerlines/plugin-alloy/types/plugin";
|
|
3
3
|
import { Options, ResolvedConfig, UserConfig } from "@shell-shock/core/types/config";
|
|
4
4
|
import { Context } from "@shell-shock/core/types/context";
|
|
5
5
|
import { ThemePluginContext, ThemePluginOptions, ThemePluginResolvedConfig } from "@shell-shock/plugin-theme/types/plugin";
|
|
@@ -13,16 +13,11 @@ interface ScriptPresetOptions extends Omit<Options, "defaultOptions">, Partial<T
|
|
|
13
13
|
* By default, Shell Shock adds the following set of default arguments to each command:
|
|
14
14
|
* - `--help` (`-h`, `-?`): Show help information.
|
|
15
15
|
* - `--version` (`-v`): Show the version of the application.
|
|
16
|
-
* - `--no-banner`: Hide the banner displayed while running the CLI application.
|
|
17
16
|
* - `--verbose`: Enable verbose output.
|
|
18
17
|
*
|
|
19
18
|
* To disable the addition of these default options, set this property to `false`, or provide a custom set of options/a function that returns them.
|
|
20
19
|
*/
|
|
21
20
|
defaultOptions?: CommandOption[] | ((context: Context, input: CommandBase) => CommandOption[]) | false;
|
|
22
|
-
/**
|
|
23
|
-
* Configuration options for the Alloy plugin.
|
|
24
|
-
*/
|
|
25
|
-
alloy?: AlloyPluginOptions;
|
|
26
21
|
}
|
|
27
22
|
type ScriptPresetUserConfig = UserConfig & ScriptPresetOptions;
|
|
28
23
|
type ScriptPresetResolvedConfig = ResolvedConfig & Required<Omit<ScriptPresetOptions, "theme">> & ThemePluginResolvedConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;UAmCiB,mBAAA,SACP,KAAK,4BAA4B,QAAQ;;AADnD;;;;;;;;;;EAmBY,cAAA,CAAA,EALN,aAK4B,EAAA,GAAA,CAAG,CAAA,OAAA,EAJpB,OAIiC,EAAA,KAAA,EAJjB,WAIoC,EAAA,GAJpB,aAIoB,EAAA,CAAA,GAAA,KAAA;AAErE;AAAyC,KAF7B,sBAAA,GAAyB,UAEI,GAFS,mBAET;AACzB,KADJ,0BAAA,GAA6B,cACzB,GAAd,QAAc,CAAL,IAAK,CAAA,mBAAA,EAAA,OAAA,CAAA,CAAA,GACd,yBADc;AAAL,KAGC,mBAHD,CAAA,wBAIe,0BAJf,GAKP,0BALO,CAAA,GAMP,kBANO,CAMY,eANZ,CAAA,GAOT,kBAPS,CAOU,eAPV,CAAA,GAQT,OARS,CAQD,eARC,CAAA"}
|
package/dist/types/plugin.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommandBase, CommandOption } from "@shell-shock/core/types/command";
|
|
2
|
-
import { AlloyPluginContext
|
|
2
|
+
import { AlloyPluginContext } from "@powerlines/plugin-alloy/types/plugin";
|
|
3
3
|
import { Options, ResolvedConfig, UserConfig } from "@shell-shock/core/types/config";
|
|
4
4
|
import { Context } from "@shell-shock/core/types/context";
|
|
5
5
|
import { ThemePluginContext, ThemePluginOptions, ThemePluginResolvedConfig } from "@shell-shock/plugin-theme/types/plugin";
|
|
@@ -13,16 +13,11 @@ interface ScriptPresetOptions extends Omit<Options, "defaultOptions">, Partial<T
|
|
|
13
13
|
* By default, Shell Shock adds the following set of default arguments to each command:
|
|
14
14
|
* - `--help` (`-h`, `-?`): Show help information.
|
|
15
15
|
* - `--version` (`-v`): Show the version of the application.
|
|
16
|
-
* - `--no-banner`: Hide the banner displayed while running the CLI application.
|
|
17
16
|
* - `--verbose`: Enable verbose output.
|
|
18
17
|
*
|
|
19
18
|
* To disable the addition of these default options, set this property to `false`, or provide a custom set of options/a function that returns them.
|
|
20
19
|
*/
|
|
21
20
|
defaultOptions?: CommandOption[] | ((context: Context, input: CommandBase) => CommandOption[]) | false;
|
|
22
|
-
/**
|
|
23
|
-
* Configuration options for the Alloy plugin.
|
|
24
|
-
*/
|
|
25
|
-
alloy?: AlloyPluginOptions;
|
|
26
21
|
}
|
|
27
22
|
type ScriptPresetUserConfig = UserConfig & ScriptPresetOptions;
|
|
28
23
|
type ScriptPresetResolvedConfig = ResolvedConfig & Required<Omit<ScriptPresetOptions, "theme">> & ThemePluginResolvedConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;UAmCiB,mBAAA,SACP,KAAK,4BAA4B,QAAQ;;AADnD;;;;;;;;;;EAmBY,cAAA,CAAA,EALN,aAK4B,EAAA,GAAA,CAAA,CAAG,OAAA,EAJpB,OAIiC,EAAA,KAAA,EAJjB,WAIoC,EAAA,GAJpB,aAIoB,EAAA,CAAA,GAAA,KAAA;AAErE;AAAyC,KAF7B,sBAAA,GAAyB,UAEI,GAFS,mBAET;AACzB,KADJ,0BAAA,GAA6B,cACzB,GAAd,QAAc,CAAL,IAAK,CAAA,mBAAA,EAAA,OAAA,CAAA,CAAA,GACd,yBADc;AAAL,KAGC,mBAHD,CAAA,wBAIe,0BAJf,GAKP,0BALO,CAAA,GAMP,kBANO,CAMY,eANZ,CAAA,GAOT,kBAPS,CAOU,eAPV,CAAA,GAQT,OARS,CAQD,eARC,CAAA"}
|