@shell-shock/core 0.17.17 → 0.17.19
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/components/command-validation-logic.cjs +1 -1
- package/dist/components/command-validation-logic.mjs +1 -1
- package/dist/components/docs.cjs +122 -21
- package/dist/components/docs.d.cts +13 -3
- package/dist/components/docs.d.cts.map +1 -1
- package/dist/components/docs.d.mts +13 -3
- package/dist/components/docs.mjs +121 -21
- package/dist/components/index.cjs +2 -1
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.mts +2 -2
- package/dist/components/index.mjs +2 -2
- package/dist/components/usage.cjs +3 -4
- package/dist/components/usage.mjs +3 -4
- package/dist/helpers/automd.cjs +133 -10
- package/dist/helpers/automd.mjs +132 -12
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/plugin-utils/reflect.cjs +5 -3
- package/dist/plugin-utils/reflect.d.cts +2 -1
- package/dist/plugin-utils/reflect.d.cts.map +1 -1
- package/dist/plugin-utils/reflect.d.mts +2 -1
- package/dist/plugin-utils/reflect.mjs +5 -3
- package/dist/plugin.cjs +8 -5
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.mjs +9 -6
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Usage, __ΩUsageProps } from "./usage.mjs";
|
|
2
|
-
import { CommandDocs, CommandDocsFile, CommandDocsUsageExample, CommandOptionsDocs, __ΩCommandDocsFileProps, __ΩCommandDocsProps, __ΩCommandDocsUsageExampleProps, __Ω
|
|
2
|
+
import { CommandArgumentDocs, CommandDocs, CommandDocsFile, CommandDocsUsageExample, CommandOptionsDocs, __ΩCommandDocsFileProps, __ΩCommandDocsProps, __ΩCommandDocsUsageExampleProps, __ΩCommandParametersDocsProps } from "./docs.mjs";
|
|
3
3
|
import { ExecBuiltin, __ΩExecBuiltinProps } from "./exec-builtin.mjs";
|
|
4
4
|
import { BooleanInputParserLogic, CommandParameterType, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose, __ΩBooleanInputParserLogicProps } from "./helpers.mjs";
|
|
5
5
|
import { ArgumentsParserLogic, CommandParserLogic, DynamicSegmentsParserLogic, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserLogic, OptionsParserLogic, __ΩArgumentsParserLogicProps, __ΩCommandParserLogicProps, __ΩDynamicSegmentsParserLogicProps, __ΩOptionsMemberParserConditionProps, __ΩOptionsMemberParserLogicProps, __ΩOptionsParserLogicProps } from "./options-parser-logic.mjs";
|
|
@@ -7,4 +7,4 @@ import { ArgsUtilities, ContextUtilities, GlobalTypeDefinitions, StateBuiltin, _
|
|
|
7
7
|
import { ColorSupportUtilities, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, ResolveModuleFunctionDeclaration, TerminalSizeDeclaration, UtilsBuiltin, __ΩUtilsBuiltinProps } from "./utils-builtin.mjs";
|
|
8
8
|
import { CommandValidationLogic, __ΩCommandValidationLogicProps } from "./command-validation-logic.mjs";
|
|
9
9
|
|
|
10
|
-
export { ArgsUtilities, ArgumentsParserLogic, BooleanInputParserLogic, ColorSupportUtilities, CommandDocs, CommandDocsFile, CommandDocsUsageExample, CommandOptionsDocs, CommandParameterType, CommandParserLogic, CommandValidationLogic, ContextUtilities, DynamicSegmentsParserLogic, EnvSupportUtilities, ExecBuiltin, FindSuggestionsDeclaration, GlobalTypeDefinitions, HyperlinkSupportUtilities, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserLogic, OptionsParserLogic, ResolveModuleFunctionDeclaration, StateBuiltin, TerminalSizeDeclaration, Usage, UtilsBuiltin, __ΩArgumentsParserLogicProps, __ΩBooleanInputParserLogicProps, __ΩCommandDocsFileProps, __ΩCommandDocsProps, __ΩCommandDocsUsageExampleProps, __Ω
|
|
10
|
+
export { ArgsUtilities, ArgumentsParserLogic, BooleanInputParserLogic, ColorSupportUtilities, CommandArgumentDocs, CommandDocs, CommandDocsFile, CommandDocsUsageExample, CommandOptionsDocs, CommandParameterType, CommandParserLogic, CommandValidationLogic, ContextUtilities, DynamicSegmentsParserLogic, EnvSupportUtilities, ExecBuiltin, FindSuggestionsDeclaration, GlobalTypeDefinitions, HyperlinkSupportUtilities, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserLogic, OptionsParserLogic, ResolveModuleFunctionDeclaration, StateBuiltin, TerminalSizeDeclaration, Usage, UtilsBuiltin, __ΩArgumentsParserLogicProps, __ΩBooleanInputParserLogicProps, __ΩCommandDocsFileProps, __ΩCommandDocsProps, __ΩCommandDocsUsageExampleProps, __ΩCommandParametersDocsProps, __ΩCommandParserLogicProps, __ΩCommandValidationLogicProps, __ΩDynamicSegmentsParserLogicProps, __ΩExecBuiltinProps, __ΩOptionsMemberParserConditionProps, __ΩOptionsMemberParserLogicProps, __ΩOptionsParserLogicProps, __ΩStateBuiltinProps, __ΩUsageProps, __ΩUtilsBuiltinProps };
|
|
@@ -54,7 +54,7 @@ function Usage(props) {
|
|
|
54
54
|
"segment",
|
|
55
55
|
"",
|
|
56
56
|
"P\"2!\"/\""
|
|
57
|
-
])).join(" ")}` : ""}${Object.values(command.children).length > 0 ? "
|
|
57
|
+
])).join(" ")}` : ""}${Object.values(command.children).length > 0 ? " <commands>" : ""}${command.args.length > 0 ? ` ${command.args.map(__assignType((param) => `<${(0, _stryke_string_format_snake_case.snakeCase)(param.name)}${(param.type === "string" || param.type === "number") && param.variadic ? "..." : ""}>`, [
|
|
58
58
|
"param",
|
|
59
59
|
"",
|
|
60
60
|
"P\"2!\"/\""
|
|
@@ -66,7 +66,6 @@ function Usage(props) {
|
|
|
66
66
|
get children() {
|
|
67
67
|
return [
|
|
68
68
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
69
|
-
_alloy_js_core.code`$ `,
|
|
70
69
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Switch, { get children() {
|
|
71
70
|
return [
|
|
72
71
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Match, {
|
|
@@ -91,11 +90,11 @@ function Usage(props) {
|
|
|
91
90
|
"segment",
|
|
92
91
|
"",
|
|
93
92
|
"P\"2!\"/\""
|
|
94
|
-
])).join(" ")}` : ""}${Object.values(command.children).length > 0 ? "
|
|
93
|
+
])).join(" ")}` : ""}${Object.values(command.children).length > 0 ? " <commands>" : ""} [options] ${command.args.length > 0 ? command.args.map(__assignType((param) => `<${(0, _stryke_string_format_snake_case.snakeCase)(param.name)}${(param.type === "string" || param.type === "number") && param.variadic ? "..." : ""}>`, [
|
|
95
94
|
"param",
|
|
96
95
|
"",
|
|
97
96
|
"P\"2!\"/\""
|
|
98
|
-
])).join(" ")
|
|
97
|
+
])).join(" ") : ""}`)
|
|
99
98
|
];
|
|
100
99
|
}
|
|
101
100
|
})
|
|
@@ -53,7 +53,7 @@ function Usage(props) {
|
|
|
53
53
|
"segment",
|
|
54
54
|
"",
|
|
55
55
|
"P\"2!\"/\""
|
|
56
|
-
])).join(" ")}` : ""}${Object.values(command.children).length > 0 ? "
|
|
56
|
+
])).join(" ")}` : ""}${Object.values(command.children).length > 0 ? " <commands>" : ""}${command.args.length > 0 ? ` ${command.args.map(__assignType((param) => `<${snakeCase(param.name)}${(param.type === "string" || param.type === "number") && param.variadic ? "..." : ""}>`, [
|
|
57
57
|
"param",
|
|
58
58
|
"",
|
|
59
59
|
"P\"2!\"/\""
|
|
@@ -65,7 +65,6 @@ function Usage(props) {
|
|
|
65
65
|
get children() {
|
|
66
66
|
return [
|
|
67
67
|
createIntrinsic("hbr", {}),
|
|
68
|
-
code`$ `,
|
|
69
68
|
createComponent(Switch, { get children() {
|
|
70
69
|
return [
|
|
71
70
|
createComponent(Match, {
|
|
@@ -90,11 +89,11 @@ function Usage(props) {
|
|
|
90
89
|
"segment",
|
|
91
90
|
"",
|
|
92
91
|
"P\"2!\"/\""
|
|
93
|
-
])).join(" ")}` : ""}${Object.values(command.children).length > 0 ? "
|
|
92
|
+
])).join(" ")}` : ""}${Object.values(command.children).length > 0 ? " <commands>" : ""} [options] ${command.args.length > 0 ? command.args.map(__assignType((param) => `<${snakeCase(param.name)}${(param.type === "string" || param.type === "number") && param.variadic ? "..." : ""}>`, [
|
|
94
93
|
"param",
|
|
95
94
|
"",
|
|
96
95
|
"P\"2!\"/\""
|
|
97
|
-
])).join(" ")
|
|
96
|
+
])).join(" ") : ""}`)
|
|
98
97
|
];
|
|
99
98
|
}
|
|
100
99
|
})
|
package/dist/helpers/automd.cjs
CHANGED
|
@@ -23,19 +23,35 @@ function __assignType(fn, args) {
|
|
|
23
23
|
*/
|
|
24
24
|
const commands = __assignType((context) => (0, automd.defineGenerator)({
|
|
25
25
|
name: "commands",
|
|
26
|
-
async generate() {
|
|
26
|
+
async generate(ctx) {
|
|
27
|
+
let commands = Object.values(context.commands).filter(__assignType((cmd) => !cmd.virtual, [
|
|
28
|
+
"cmd",
|
|
29
|
+
"",
|
|
30
|
+
"P\"2!\"/\""
|
|
31
|
+
]));
|
|
32
|
+
if (ctx.args.command) {
|
|
33
|
+
if (!context.commands[ctx.args.command]) throw new Error(`The command "${ctx.args.command}" does not exist in the application.`);
|
|
34
|
+
commands = [context.commands[ctx.args.command]];
|
|
35
|
+
}
|
|
27
36
|
return { contents: (0, _powerlines_plugin_alloy_render.renderString)(context, [
|
|
28
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
38
|
+
get when() {
|
|
39
|
+
return !ctx.args.command;
|
|
40
|
+
},
|
|
41
|
+
get children() {
|
|
42
|
+
return [
|
|
43
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_markdown.Heading, {
|
|
44
|
+
level: 2,
|
|
45
|
+
children: "Commands"
|
|
46
|
+
}),
|
|
47
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
48
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`The following commands are available in the ${require_context_helpers.getAppTitle(context, true)} command-line interface application:`),
|
|
49
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
|
|
50
|
+
];
|
|
51
|
+
}
|
|
31
52
|
}),
|
|
32
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
33
|
-
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`The following commands are available in the ${require_context_helpers.getAppTitle(context, true)} command-line interface application:`),
|
|
34
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
35
53
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
36
|
-
|
|
37
|
-
return Object.values(context.commands);
|
|
38
|
-
},
|
|
54
|
+
each: commands,
|
|
39
55
|
doubleHardline: true,
|
|
40
56
|
get children() {
|
|
41
57
|
return __assignType((child) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
@@ -64,7 +80,114 @@ const commands = __assignType((context) => (0, automd.defineGenerator)({
|
|
|
64
80
|
"",
|
|
65
81
|
"P\"w!2\"\"/#"
|
|
66
82
|
]);
|
|
83
|
+
/**
|
|
84
|
+
* AutoMD generator to generate usage examples for a specific command.
|
|
85
|
+
*
|
|
86
|
+
* @param context - The generator context.
|
|
87
|
+
* @returns The generated usage content.
|
|
88
|
+
*/
|
|
89
|
+
const usage = __assignType((context) => (0, automd.defineGenerator)({
|
|
90
|
+
name: "usage",
|
|
91
|
+
async generate(ctx) {
|
|
92
|
+
if (!ctx.args.command) throw new Error("The 'usage' generator requires the \"command\" argument.");
|
|
93
|
+
if (!context.commands[ctx.args.command]) throw new Error(`The command "${ctx.args.command}" does not exist in the application.`);
|
|
94
|
+
let packageManagers = [
|
|
95
|
+
"npm",
|
|
96
|
+
"yarn",
|
|
97
|
+
"pnpm",
|
|
98
|
+
"bun"
|
|
99
|
+
];
|
|
100
|
+
if (ctx.args.packageManager) packageManagers = [String(ctx.args.packageManager)];
|
|
101
|
+
if (packageManagers.some(__assignType((pm) => ![
|
|
102
|
+
"npm",
|
|
103
|
+
"yarn",
|
|
104
|
+
"pnpm",
|
|
105
|
+
"bun"
|
|
106
|
+
].includes(pm), [
|
|
107
|
+
"pm",
|
|
108
|
+
"",
|
|
109
|
+
"P\"2!\"/\""
|
|
110
|
+
]))) throw new Error(`Invalid package manager specified. Supported package managers are: npm, yarn, pnpm, and bun.`);
|
|
111
|
+
return { contents: (0, _powerlines_plugin_alloy_render.renderString)(context, [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
112
|
+
each: packageManagers,
|
|
113
|
+
doubleHardline: true,
|
|
114
|
+
get children() {
|
|
115
|
+
return __assignType((packageManager) => [(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_docs.CommandDocsUsageExample, {
|
|
116
|
+
packageManager,
|
|
117
|
+
get command() {
|
|
118
|
+
return context.commands[ctx.args.command];
|
|
119
|
+
},
|
|
120
|
+
get expand() {
|
|
121
|
+
return packageManagers && packageManagers.length > 1;
|
|
122
|
+
}
|
|
123
|
+
})], [
|
|
124
|
+
"packageManager",
|
|
125
|
+
"",
|
|
126
|
+
"P\"2!\"/\""
|
|
127
|
+
]);
|
|
128
|
+
}
|
|
129
|
+
})]) };
|
|
130
|
+
}
|
|
131
|
+
}), [
|
|
132
|
+
"Context",
|
|
133
|
+
"context",
|
|
134
|
+
"",
|
|
135
|
+
"P\"w!2\"\"/#"
|
|
136
|
+
]);
|
|
137
|
+
/**
|
|
138
|
+
* AutoMD generator to generate options for a specific command.
|
|
139
|
+
*
|
|
140
|
+
* @param context - The generator context.
|
|
141
|
+
* @returns The generated options content.
|
|
142
|
+
*/
|
|
143
|
+
const options = __assignType((context) => (0, automd.defineGenerator)({
|
|
144
|
+
name: "options",
|
|
145
|
+
generate: __assignType(async function generate(ctx) {
|
|
146
|
+
if (!ctx.args.command) throw new Error("The 'options' generator requires the \"command\" argument.");
|
|
147
|
+
if (!context.commands[ctx.args.command]) throw new Error(`The command "${ctx.args.command}" does not exist in the application.`);
|
|
148
|
+
return { contents: (0, _powerlines_plugin_alloy_render.renderString)(context, (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_docs.CommandOptionsDocs, { get command() {
|
|
149
|
+
return context.commands[ctx.args.command];
|
|
150
|
+
} })) };
|
|
151
|
+
}, [
|
|
152
|
+
"ctx",
|
|
153
|
+
"generate",
|
|
154
|
+
"P\"2!\"/\""
|
|
155
|
+
])
|
|
156
|
+
}), [
|
|
157
|
+
"Context",
|
|
158
|
+
"context",
|
|
159
|
+
"",
|
|
160
|
+
"P\"w!2\"\"/#"
|
|
161
|
+
]);
|
|
162
|
+
/**
|
|
163
|
+
* AutoMD generator to generate arguments for a specific command.
|
|
164
|
+
*
|
|
165
|
+
* @param context - The generator context.
|
|
166
|
+
* @returns The generated arguments content.
|
|
167
|
+
*/
|
|
168
|
+
const args = __assignType((context) => (0, automd.defineGenerator)({
|
|
169
|
+
name: "args",
|
|
170
|
+
generate: __assignType(async function generate(ctx) {
|
|
171
|
+
if (!ctx.args.command) throw new Error("The 'args' generator requires the \"command\" argument.");
|
|
172
|
+
if (!context.commands[ctx.args.command]) throw new Error(`The command "${ctx.args.command}" does not exist in the application.`);
|
|
173
|
+
return { contents: (0, _powerlines_plugin_alloy_render.renderString)(context, (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_docs.CommandArgumentDocs, { get command() {
|
|
174
|
+
return context.commands[ctx.args.command];
|
|
175
|
+
} })) };
|
|
176
|
+
}, [
|
|
177
|
+
"ctx",
|
|
178
|
+
"generate",
|
|
179
|
+
"P\"2!\"/\""
|
|
180
|
+
])
|
|
181
|
+
}), [
|
|
182
|
+
"Context",
|
|
183
|
+
"context",
|
|
184
|
+
"",
|
|
185
|
+
"P\"w!2\"\"/#"
|
|
186
|
+
]);
|
|
67
187
|
|
|
68
188
|
//#endregion
|
|
189
|
+
exports.args = args;
|
|
69
190
|
exports.commands = commands;
|
|
191
|
+
exports.options = options;
|
|
192
|
+
exports.usage = usage;
|
|
70
193
|
//# sourceMappingURL=automd.cjs.map
|
package/dist/helpers/automd.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getAppTitle } from "../plugin-utils/context-helpers.mjs";
|
|
2
|
-
import { CommandDocs } from "../components/docs.mjs";
|
|
2
|
+
import { CommandArgumentDocs, CommandDocs, CommandDocsUsageExample, CommandOptionsDocs } from "../components/docs.mjs";
|
|
3
3
|
import "../plugin-utils/index.mjs";
|
|
4
4
|
import { createComponent, memo } from "@alloy-js/core/jsx-runtime";
|
|
5
5
|
import { For, Show, code } from "@alloy-js/core";
|
|
@@ -23,19 +23,35 @@ function __assignType(fn, args) {
|
|
|
23
23
|
*/
|
|
24
24
|
const commands = __assignType((context) => defineGenerator({
|
|
25
25
|
name: "commands",
|
|
26
|
-
async generate() {
|
|
26
|
+
async generate(ctx) {
|
|
27
|
+
let commands = Object.values(context.commands).filter(__assignType((cmd) => !cmd.virtual, [
|
|
28
|
+
"cmd",
|
|
29
|
+
"",
|
|
30
|
+
"P\"2!\"/\""
|
|
31
|
+
]));
|
|
32
|
+
if (ctx.args.command) {
|
|
33
|
+
if (!context.commands[ctx.args.command]) throw new Error(`The command "${ctx.args.command}" does not exist in the application.`);
|
|
34
|
+
commands = [context.commands[ctx.args.command]];
|
|
35
|
+
}
|
|
27
36
|
return { contents: renderString(context, [
|
|
28
|
-
createComponent(
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
createComponent(Show, {
|
|
38
|
+
get when() {
|
|
39
|
+
return !ctx.args.command;
|
|
40
|
+
},
|
|
41
|
+
get children() {
|
|
42
|
+
return [
|
|
43
|
+
createComponent(Heading, {
|
|
44
|
+
level: 2,
|
|
45
|
+
children: "Commands"
|
|
46
|
+
}),
|
|
47
|
+
createComponent(Spacing, {}),
|
|
48
|
+
memo(() => code`The following commands are available in the ${getAppTitle(context, true)} command-line interface application:`),
|
|
49
|
+
createComponent(Spacing, {})
|
|
50
|
+
];
|
|
51
|
+
}
|
|
31
52
|
}),
|
|
32
|
-
createComponent(Spacing, {}),
|
|
33
|
-
memo(() => code`The following commands are available in the ${getAppTitle(context, true)} command-line interface application:`),
|
|
34
|
-
createComponent(Spacing, {}),
|
|
35
53
|
createComponent(For, {
|
|
36
|
-
|
|
37
|
-
return Object.values(context.commands);
|
|
38
|
-
},
|
|
54
|
+
each: commands,
|
|
39
55
|
doubleHardline: true,
|
|
40
56
|
get children() {
|
|
41
57
|
return __assignType((child) => createComponent(Show, {
|
|
@@ -64,7 +80,111 @@ const commands = __assignType((context) => defineGenerator({
|
|
|
64
80
|
"",
|
|
65
81
|
"P\"w!2\"\"/#"
|
|
66
82
|
]);
|
|
83
|
+
/**
|
|
84
|
+
* AutoMD generator to generate usage examples for a specific command.
|
|
85
|
+
*
|
|
86
|
+
* @param context - The generator context.
|
|
87
|
+
* @returns The generated usage content.
|
|
88
|
+
*/
|
|
89
|
+
const usage = __assignType((context) => defineGenerator({
|
|
90
|
+
name: "usage",
|
|
91
|
+
async generate(ctx) {
|
|
92
|
+
if (!ctx.args.command) throw new Error("The 'usage' generator requires the \"command\" argument.");
|
|
93
|
+
if (!context.commands[ctx.args.command]) throw new Error(`The command "${ctx.args.command}" does not exist in the application.`);
|
|
94
|
+
let packageManagers = [
|
|
95
|
+
"npm",
|
|
96
|
+
"yarn",
|
|
97
|
+
"pnpm",
|
|
98
|
+
"bun"
|
|
99
|
+
];
|
|
100
|
+
if (ctx.args.packageManager) packageManagers = [String(ctx.args.packageManager)];
|
|
101
|
+
if (packageManagers.some(__assignType((pm) => ![
|
|
102
|
+
"npm",
|
|
103
|
+
"yarn",
|
|
104
|
+
"pnpm",
|
|
105
|
+
"bun"
|
|
106
|
+
].includes(pm), [
|
|
107
|
+
"pm",
|
|
108
|
+
"",
|
|
109
|
+
"P\"2!\"/\""
|
|
110
|
+
]))) throw new Error(`Invalid package manager specified. Supported package managers are: npm, yarn, pnpm, and bun.`);
|
|
111
|
+
return { contents: renderString(context, [createComponent(For, {
|
|
112
|
+
each: packageManagers,
|
|
113
|
+
doubleHardline: true,
|
|
114
|
+
get children() {
|
|
115
|
+
return __assignType((packageManager) => [createComponent(CommandDocsUsageExample, {
|
|
116
|
+
packageManager,
|
|
117
|
+
get command() {
|
|
118
|
+
return context.commands[ctx.args.command];
|
|
119
|
+
},
|
|
120
|
+
get expand() {
|
|
121
|
+
return packageManagers && packageManagers.length > 1;
|
|
122
|
+
}
|
|
123
|
+
})], [
|
|
124
|
+
"packageManager",
|
|
125
|
+
"",
|
|
126
|
+
"P\"2!\"/\""
|
|
127
|
+
]);
|
|
128
|
+
}
|
|
129
|
+
})]) };
|
|
130
|
+
}
|
|
131
|
+
}), [
|
|
132
|
+
"Context",
|
|
133
|
+
"context",
|
|
134
|
+
"",
|
|
135
|
+
"P\"w!2\"\"/#"
|
|
136
|
+
]);
|
|
137
|
+
/**
|
|
138
|
+
* AutoMD generator to generate options for a specific command.
|
|
139
|
+
*
|
|
140
|
+
* @param context - The generator context.
|
|
141
|
+
* @returns The generated options content.
|
|
142
|
+
*/
|
|
143
|
+
const options = __assignType((context) => defineGenerator({
|
|
144
|
+
name: "options",
|
|
145
|
+
generate: __assignType(async function generate(ctx) {
|
|
146
|
+
if (!ctx.args.command) throw new Error("The 'options' generator requires the \"command\" argument.");
|
|
147
|
+
if (!context.commands[ctx.args.command]) throw new Error(`The command "${ctx.args.command}" does not exist in the application.`);
|
|
148
|
+
return { contents: renderString(context, createComponent(CommandOptionsDocs, { get command() {
|
|
149
|
+
return context.commands[ctx.args.command];
|
|
150
|
+
} })) };
|
|
151
|
+
}, [
|
|
152
|
+
"ctx",
|
|
153
|
+
"generate",
|
|
154
|
+
"P\"2!\"/\""
|
|
155
|
+
])
|
|
156
|
+
}), [
|
|
157
|
+
"Context",
|
|
158
|
+
"context",
|
|
159
|
+
"",
|
|
160
|
+
"P\"w!2\"\"/#"
|
|
161
|
+
]);
|
|
162
|
+
/**
|
|
163
|
+
* AutoMD generator to generate arguments for a specific command.
|
|
164
|
+
*
|
|
165
|
+
* @param context - The generator context.
|
|
166
|
+
* @returns The generated arguments content.
|
|
167
|
+
*/
|
|
168
|
+
const args = __assignType((context) => defineGenerator({
|
|
169
|
+
name: "args",
|
|
170
|
+
generate: __assignType(async function generate(ctx) {
|
|
171
|
+
if (!ctx.args.command) throw new Error("The 'args' generator requires the \"command\" argument.");
|
|
172
|
+
if (!context.commands[ctx.args.command]) throw new Error(`The command "${ctx.args.command}" does not exist in the application.`);
|
|
173
|
+
return { contents: renderString(context, createComponent(CommandArgumentDocs, { get command() {
|
|
174
|
+
return context.commands[ctx.args.command];
|
|
175
|
+
} })) };
|
|
176
|
+
}, [
|
|
177
|
+
"ctx",
|
|
178
|
+
"generate",
|
|
179
|
+
"P\"2!\"/\""
|
|
180
|
+
])
|
|
181
|
+
}), [
|
|
182
|
+
"Context",
|
|
183
|
+
"context",
|
|
184
|
+
"",
|
|
185
|
+
"P\"w!2\"\"/#"
|
|
186
|
+
]);
|
|
67
187
|
|
|
68
188
|
//#endregion
|
|
69
|
-
export { commands };
|
|
189
|
+
export { args, commands, options, usage };
|
|
70
190
|
//# sourceMappingURL=automd.mjs.map
|
package/dist/package.cjs
CHANGED
package/dist/package.mjs
CHANGED
|
@@ -8,11 +8,12 @@ function __assignType(fn, args) {
|
|
|
8
8
|
* Sort command options alphabetically by name, placing boolean options with negatives appropriately.
|
|
9
9
|
*
|
|
10
10
|
* @param options - The array of command options to sort.
|
|
11
|
+
* @param skipNegatives - Whether to skip negative options when sorting (default: true).
|
|
11
12
|
* @returns A new array of sorted command options.
|
|
12
13
|
*/
|
|
13
|
-
function sortOptions(options) {
|
|
14
|
+
function sortOptions(options, skipNegatives = true) {
|
|
14
15
|
if (!options || options.length === 0) return [];
|
|
15
|
-
return options.filter(__assignType((arg) => arg.type !== "boolean" || arg.variadic || !arg.isNegativeOf, [
|
|
16
|
+
return options.filter(__assignType((arg) => arg.type !== "boolean" || arg.variadic || !skipNegatives || !arg.isNegativeOf, [
|
|
16
17
|
"arg",
|
|
17
18
|
"",
|
|
18
19
|
"P\"2!\"/\""
|
|
@@ -42,9 +43,10 @@ function sortOptions(options) {
|
|
|
42
43
|
sortOptions.__type = [
|
|
43
44
|
"CommandOption",
|
|
44
45
|
"options",
|
|
46
|
+
"skipNegatives",
|
|
45
47
|
"sortOptions",
|
|
46
48
|
"Sort command options alphabetically by name, placing boolean options with negatives appropriately.",
|
|
47
|
-
"P\"w!F2\"\"w!F
|
|
49
|
+
"P\"w!F2\"\"2#\"w!F/$?%"
|
|
48
50
|
];
|
|
49
51
|
|
|
50
52
|
//#endregion
|
|
@@ -5,9 +5,10 @@ import { CommandOption } from "../types/command.cjs";
|
|
|
5
5
|
* Sort command options alphabetically by name, placing boolean options with negatives appropriately.
|
|
6
6
|
*
|
|
7
7
|
* @param options - The array of command options to sort.
|
|
8
|
+
* @param skipNegatives - Whether to skip negative options when sorting (default: true).
|
|
8
9
|
* @returns A new array of sorted command options.
|
|
9
10
|
*/
|
|
10
|
-
declare function sortOptions(options: CommandOption[]): CommandOption[];
|
|
11
|
+
declare function sortOptions(options: CommandOption[], skipNegatives?: boolean): CommandOption[];
|
|
11
12
|
//#endregion
|
|
12
13
|
export { sortOptions };
|
|
13
14
|
//# sourceMappingURL=reflect.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reflect.d.cts","names":[],"sources":["../../src/plugin-utils/reflect.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"reflect.d.cts","names":[],"sources":["../../src/plugin-utils/reflect.ts"],"mappings":";;;;;AA2BA;;;;;iBAAgB,WAAA,CACd,OAAA,EAAS,aAAA,IACT,aAAA,aACC,aAAa"}
|
|
@@ -5,9 +5,10 @@ import { CommandOption } from "../types/command.mjs";
|
|
|
5
5
|
* Sort command options alphabetically by name, placing boolean options with negatives appropriately.
|
|
6
6
|
*
|
|
7
7
|
* @param options - The array of command options to sort.
|
|
8
|
+
* @param skipNegatives - Whether to skip negative options when sorting (default: true).
|
|
8
9
|
* @returns A new array of sorted command options.
|
|
9
10
|
*/
|
|
10
|
-
declare function sortOptions(options: CommandOption[]): CommandOption[];
|
|
11
|
+
declare function sortOptions(options: CommandOption[], skipNegatives?: boolean): CommandOption[];
|
|
11
12
|
//#endregion
|
|
12
13
|
export { sortOptions };
|
|
13
14
|
//# sourceMappingURL=reflect.d.mts.map
|
|
@@ -7,11 +7,12 @@ function __assignType(fn, args) {
|
|
|
7
7
|
* Sort command options alphabetically by name, placing boolean options with negatives appropriately.
|
|
8
8
|
*
|
|
9
9
|
* @param options - The array of command options to sort.
|
|
10
|
+
* @param skipNegatives - Whether to skip negative options when sorting (default: true).
|
|
10
11
|
* @returns A new array of sorted command options.
|
|
11
12
|
*/
|
|
12
|
-
function sortOptions(options) {
|
|
13
|
+
function sortOptions(options, skipNegatives = true) {
|
|
13
14
|
if (!options || options.length === 0) return [];
|
|
14
|
-
return options.filter(__assignType((arg) => arg.type !== "boolean" || arg.variadic || !arg.isNegativeOf, [
|
|
15
|
+
return options.filter(__assignType((arg) => arg.type !== "boolean" || arg.variadic || !skipNegatives || !arg.isNegativeOf, [
|
|
15
16
|
"arg",
|
|
16
17
|
"",
|
|
17
18
|
"P\"2!\"/\""
|
|
@@ -41,9 +42,10 @@ function sortOptions(options) {
|
|
|
41
42
|
sortOptions.__type = [
|
|
42
43
|
"CommandOption",
|
|
43
44
|
"options",
|
|
45
|
+
"skipNegatives",
|
|
44
46
|
"sortOptions",
|
|
45
47
|
"Sort command options alphabetically by name, placing boolean options with negatives appropriately.",
|
|
46
|
-
"P\"w!F2\"\"w!F
|
|
48
|
+
"P\"w!F2\"\"2#\"w!F/$?%"
|
|
47
49
|
];
|
|
48
50
|
|
|
49
51
|
//#endregion
|
package/dist/plugin.cjs
CHANGED
|
@@ -53,7 +53,7 @@ const MAX_DEPTH = 50;
|
|
|
53
53
|
/**
|
|
54
54
|
* The core Powerlines plugin to build Shell Shock projects.
|
|
55
55
|
*/
|
|
56
|
-
const plugin = __assignType((options = {}) => {
|
|
56
|
+
const plugin = __assignType((options$1 = {}) => {
|
|
57
57
|
return [
|
|
58
58
|
(_powerlines_plugin_tsdown.default.Ω = [["Context", "\"w!"]], (0, _powerlines_plugin_tsdown.default)()),
|
|
59
59
|
(_powerlines_plugin_automd.default.Ω = [["Context", "\"w!"]], (0, _powerlines_plugin_automd.default)()),
|
|
@@ -61,7 +61,7 @@ const plugin = __assignType((options = {}) => {
|
|
|
61
61
|
name: "shell-shock/core:config",
|
|
62
62
|
config: __assignType(async function config() {
|
|
63
63
|
this.debug("Resolving the Shell Shock configuration.");
|
|
64
|
-
return (0, defu.defu)(options, {
|
|
64
|
+
return (0, defu.defu)(options$1, {
|
|
65
65
|
name: require_context_helpers.getAppName(this),
|
|
66
66
|
title: require_context_helpers.getAppTitle(this),
|
|
67
67
|
description: require_context_helpers.getAppDescription(this),
|
|
@@ -125,7 +125,7 @@ const plugin = __assignType((options = {}) => {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
},
|
|
128
|
-
...(_powerlines_plugin_nodejs.default.Ω = [["Context", "\"w!"]], (0, _powerlines_plugin_nodejs.default)((0, defu.defu)(options ?? {}, { env: {
|
|
128
|
+
...(_powerlines_plugin_nodejs.default.Ω = [["Context", "\"w!"]], (0, _powerlines_plugin_nodejs.default)((0, defu.defu)(options$1 ?? {}, { env: {
|
|
129
129
|
config: "@shell-shock/core/types/env#ShellShockEnv",
|
|
130
130
|
validate: false
|
|
131
131
|
} }))),
|
|
@@ -446,11 +446,14 @@ const plugin = __assignType((options = {}) => {
|
|
|
446
446
|
this.config.automd ??= {};
|
|
447
447
|
this.config.automd.generators = {
|
|
448
448
|
...this.config.automd.generators ?? {},
|
|
449
|
-
commands: require_automd.commands(this)
|
|
449
|
+
commands: require_automd.commands(this),
|
|
450
|
+
usage: require_automd.usage(this),
|
|
451
|
+
options: require_automd.options(this),
|
|
452
|
+
args: require_automd.args(this)
|
|
450
453
|
};
|
|
451
454
|
}, ["configResolved", "P\"/!"]),
|
|
452
455
|
async docs() {
|
|
453
|
-
this.debug("Rendering
|
|
456
|
+
this.debug("Rendering CLI command reference documentation and writing to the output directory.");
|
|
454
457
|
const commands = this.inputs.map(__assignType((input) => require_get_command_tree.getCommandTree(this, input.segments), [
|
|
455
458
|
"input",
|
|
456
459
|
"",
|
package/dist/plugin.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../src/plugin.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../src/plugin.tsx"],"mappings":";;;;;;;AA6FA;cAAa,MAAA,oBAA2B,OAAA,GAAU,OAAA,EAChD,OAAA,GAAS,OAAA,KACR,MAAA,CAAO,QAAA"}
|
package/dist/plugin.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { traverseCommands } from "./plugin-utils/traverse-command-tree.mjs";
|
|
|
5
5
|
import { getCommandTree } from "./plugin-utils/get-command-tree.mjs";
|
|
6
6
|
import { StateBuiltin } from "./components/state-builtin.mjs";
|
|
7
7
|
import { UtilsBuiltin } from "./components/utils-builtin.mjs";
|
|
8
|
-
import { commands } from "./helpers/automd.mjs";
|
|
8
|
+
import { args, commands, options, usage } from "./helpers/automd.mjs";
|
|
9
9
|
import { getFramework } from "./helpers/get-framework.mjs";
|
|
10
10
|
import { findCommandsRoot, resolveCommandId, resolveCommandName, resolveCommandPath } from "./helpers/paths.mjs";
|
|
11
11
|
import { writeCommandsPersistence } from "./helpers/persistence.mjs";
|
|
@@ -48,7 +48,7 @@ const MAX_DEPTH = 50;
|
|
|
48
48
|
/**
|
|
49
49
|
* The core Powerlines plugin to build Shell Shock projects.
|
|
50
50
|
*/
|
|
51
|
-
const plugin = __assignType((options = {}) => {
|
|
51
|
+
const plugin = __assignType((options$1 = {}) => {
|
|
52
52
|
return [
|
|
53
53
|
(tsdown.Ω = [["Context", "\"w!"]], tsdown()),
|
|
54
54
|
(automd.Ω = [["Context", "\"w!"]], automd()),
|
|
@@ -56,7 +56,7 @@ const plugin = __assignType((options = {}) => {
|
|
|
56
56
|
name: "shell-shock/core:config",
|
|
57
57
|
config: __assignType(async function config() {
|
|
58
58
|
this.debug("Resolving the Shell Shock configuration.");
|
|
59
|
-
return defu(options, {
|
|
59
|
+
return defu(options$1, {
|
|
60
60
|
name: getAppName(this),
|
|
61
61
|
title: getAppTitle(this),
|
|
62
62
|
description: getAppDescription(this),
|
|
@@ -120,7 +120,7 @@ const plugin = __assignType((options = {}) => {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
},
|
|
123
|
-
...(nodejs.Ω = [["Context", "\"w!"]], nodejs(defu(options ?? {}, { env: {
|
|
123
|
+
...(nodejs.Ω = [["Context", "\"w!"]], nodejs(defu(options$1 ?? {}, { env: {
|
|
124
124
|
config: "@shell-shock/core/types/env#ShellShockEnv",
|
|
125
125
|
validate: false
|
|
126
126
|
} }))),
|
|
@@ -441,11 +441,14 @@ const plugin = __assignType((options = {}) => {
|
|
|
441
441
|
this.config.automd ??= {};
|
|
442
442
|
this.config.automd.generators = {
|
|
443
443
|
...this.config.automd.generators ?? {},
|
|
444
|
-
commands: commands(this)
|
|
444
|
+
commands: commands(this),
|
|
445
|
+
usage: usage(this),
|
|
446
|
+
options: options(this),
|
|
447
|
+
args: args(this)
|
|
445
448
|
};
|
|
446
449
|
}, ["configResolved", "P\"/!"]),
|
|
447
450
|
async docs() {
|
|
448
|
-
this.debug("Rendering
|
|
451
|
+
this.debug("Rendering CLI command reference documentation and writing to the output directory.");
|
|
449
452
|
const commands = this.inputs.map(__assignType((input) => getCommandTree(this, input.segments), [
|
|
450
453
|
"input",
|
|
451
454
|
"",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shell-shock/core",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.19",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A package containing the core Shell Shock functionality used to build and manage a command-line application.",
|
|
6
6
|
"keywords": ["shell-shock", "powerlines", "storm-software"],
|
|
@@ -407,5 +407,5 @@
|
|
|
407
407
|
"typescript": "^6.0.3"
|
|
408
408
|
},
|
|
409
409
|
"publishConfig": { "access": "public" },
|
|
410
|
-
"gitHead": "
|
|
410
|
+
"gitHead": "f65ed318b22c10407fc4f3770b3f1f742d02ab35"
|
|
411
411
|
}
|