@qui-cli/core 6.0.1 → 6.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/Core.js +19 -19
- package/dist/Help.js +1 -2
- package/dist/Positionals.d.ts +1 -0
- package/dist/Positionals.js +16 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [6.0.2](https://github.com/battis/qui-cli/compare/core/6.0.1...core/6.0.2) (2026-02-21)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* display positional arg documentation ([c97c454](https://github.com/battis/qui-cli/commit/c97c45477df474880b6ae3071d4e9c2f11b17a97))
|
|
11
|
+
|
|
5
12
|
## [6.0.1](https://github.com/battis/qui-cli/compare/core/6.0.0...core/6.0.1) (2026-02-21)
|
|
6
13
|
|
|
7
14
|
|
package/dist/Core.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as Plugin from '@qui-cli/plugin';
|
|
2
|
+
import * as Help from './Help.js';
|
|
2
3
|
import * as JackSpeak from './JackSpeak.js';
|
|
3
4
|
import * as Positionals from './Positionals.js';
|
|
4
5
|
export * from './Usage.js';
|
|
@@ -18,31 +19,30 @@ export async function configure(config = {}) {
|
|
|
18
19
|
}
|
|
19
20
|
await Plugin.Registrar.configure({ positionals, jackspeak });
|
|
20
21
|
}
|
|
22
|
+
function requireUnusedOptions(plugin) {
|
|
23
|
+
return (!!plugin.options &&
|
|
24
|
+
plugin.name !== Positionals.name &&
|
|
25
|
+
plugin.name !== Help.name);
|
|
26
|
+
}
|
|
21
27
|
export async function init(externalOptions) {
|
|
22
28
|
if (initialized) {
|
|
23
29
|
throw new Error(`Already initialized with user-provided command line arguments.`);
|
|
24
30
|
}
|
|
31
|
+
JackSpeak.args(Help.options());
|
|
32
|
+
JackSpeak.args(Positionals.options());
|
|
33
|
+
const usage = [
|
|
34
|
+
...(await Promise.all(Plugin.Registrar.registered()
|
|
35
|
+
.filter(requireUnusedOptions)
|
|
36
|
+
.map(async (plugin) => await plugin.options())))
|
|
37
|
+
];
|
|
38
|
+
if (externalOptions) {
|
|
39
|
+
usage.push(Plugin.documentDefaults(externalOptions));
|
|
40
|
+
}
|
|
25
41
|
if (lifoUsage) {
|
|
26
|
-
|
|
27
|
-
if (externalOptions) {
|
|
28
|
-
JackSpeak.args(Plugin.documentDefaults(externalOptions));
|
|
29
|
-
}
|
|
30
|
-
for (const plugin of Plugin.Registrar.registered().toReversed()) {
|
|
31
|
-
if (plugin.options) {
|
|
32
|
-
JackSpeak.args(await plugin.options());
|
|
33
|
-
}
|
|
34
|
-
}
|
|
42
|
+
usage.reverse();
|
|
35
43
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
for (const plugin of Plugin.Registrar.registered()) {
|
|
39
|
-
if (plugin.options) {
|
|
40
|
-
JackSpeak.args(await plugin.options());
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if (externalOptions) {
|
|
44
|
-
JackSpeak.args(Plugin.documentDefaults(externalOptions));
|
|
45
|
-
}
|
|
44
|
+
for (const options of usage) {
|
|
45
|
+
JackSpeak.args(options);
|
|
46
46
|
}
|
|
47
47
|
const args = JackSpeak.parse();
|
|
48
48
|
await Plugin.Registrar.init(args);
|
package/dist/Help.js
CHANGED
|
@@ -7,10 +7,9 @@ export function configure(config = {}) {
|
|
|
7
7
|
}
|
|
8
8
|
export function options() {
|
|
9
9
|
return {
|
|
10
|
-
man: [{ level: 1, text: 'Usage information' }],
|
|
11
10
|
flag: {
|
|
12
11
|
help: {
|
|
13
|
-
description: '
|
|
12
|
+
description: 'Show this usage information',
|
|
14
13
|
short: 'h'
|
|
15
14
|
}
|
|
16
15
|
}
|
package/dist/Positionals.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ export declare function maximumUnnamedCount(): number | undefined;
|
|
|
41
41
|
* @param maxUnnamed Number of optional args to allow
|
|
42
42
|
*/
|
|
43
43
|
export declare function requireNoMoreThanUnnamedArgs(maxUnnamed: number): void;
|
|
44
|
+
export declare function options(): Plugin.Options;
|
|
44
45
|
export declare function init(args: Plugin.ExpectedArguments<() => Plugin.Options>): void;
|
|
45
46
|
export declare function usageArgs(): string;
|
|
46
47
|
export declare function usage(usage: string, isMarkdown?: boolean): string;
|
package/dist/Positionals.js
CHANGED
|
@@ -109,6 +109,22 @@ export function requireNoMoreThanUnnamedArgs(maxUnnamed) {
|
|
|
109
109
|
}
|
|
110
110
|
requireNoMoreThan(namedCount() + maxUnnamed);
|
|
111
111
|
}
|
|
112
|
+
export function options() {
|
|
113
|
+
const man = [];
|
|
114
|
+
for (const arg in configSet) {
|
|
115
|
+
man.push({
|
|
116
|
+
level: 2,
|
|
117
|
+
text: `${Colors.positionalArg(arg)}${configSet[arg].hint ? `=<${configSet[arg].hint}>` : ''}`
|
|
118
|
+
});
|
|
119
|
+
if (configSet[arg].description) {
|
|
120
|
+
man.push({ text: configSet[arg].description });
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (man.length > 0) {
|
|
124
|
+
man.unshift({ level: 1, text: 'Positional arguments' });
|
|
125
|
+
}
|
|
126
|
+
return { man };
|
|
127
|
+
}
|
|
112
128
|
export function init(args) {
|
|
113
129
|
positionals = [...args.positionals];
|
|
114
130
|
}
|