@optique/core 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/primitives.cjs +14 -9
- package/dist/primitives.js +14 -9
- package/package.json +2 -2
package/dist/primitives.cjs
CHANGED
|
@@ -247,7 +247,7 @@ function* getSuggestionsWithDependency(valueParser, prefix, dependencyRegistry,
|
|
|
247
247
|
* Internal sync helper for option suggest functionality.
|
|
248
248
|
* @internal
|
|
249
249
|
*/
|
|
250
|
-
function* suggestOptionSync(optionNames$1, valueParser, hidden, context, prefix) {
|
|
250
|
+
function* suggestOptionSync(optionNames$1, valueParser, hidden, description, context, prefix) {
|
|
251
251
|
if (hidden) return;
|
|
252
252
|
const equalsIndex = prefix.indexOf("=");
|
|
253
253
|
if (equalsIndex >= 0) {
|
|
@@ -275,7 +275,8 @@ function* suggestOptionSync(optionNames$1, valueParser, hidden, context, prefix)
|
|
|
275
275
|
if (prefix === "-" && optionName$1.length !== 2) continue;
|
|
276
276
|
yield {
|
|
277
277
|
kind: "literal",
|
|
278
|
-
text: optionName$1
|
|
278
|
+
text: optionName$1,
|
|
279
|
+
...description && { description }
|
|
279
280
|
};
|
|
280
281
|
}
|
|
281
282
|
}
|
|
@@ -331,7 +332,7 @@ async function* getSuggestionsWithDependencyAsync(valueParser, prefix, dependenc
|
|
|
331
332
|
* Internal async helper for option suggest functionality.
|
|
332
333
|
* @internal
|
|
333
334
|
*/
|
|
334
|
-
async function* suggestOptionAsync(optionNames$1, valueParser, hidden, context, prefix) {
|
|
335
|
+
async function* suggestOptionAsync(optionNames$1, valueParser, hidden, description, context, prefix) {
|
|
335
336
|
if (hidden) return;
|
|
336
337
|
const equalsIndex = prefix.indexOf("=");
|
|
337
338
|
if (equalsIndex >= 0) {
|
|
@@ -359,7 +360,8 @@ async function* suggestOptionAsync(optionNames$1, valueParser, hidden, context,
|
|
|
359
360
|
if (prefix === "-" && optionName$1.length !== 2) continue;
|
|
360
361
|
yield {
|
|
361
362
|
kind: "literal",
|
|
362
|
-
text: optionName$1
|
|
363
|
+
text: optionName$1,
|
|
364
|
+
...description && { description }
|
|
363
365
|
};
|
|
364
366
|
}
|
|
365
367
|
}
|
|
@@ -628,8 +630,8 @@ function option(...args) {
|
|
|
628
630
|
return require_mode_dispatch.dispatchByMode(mode, completeSync, completeAsync);
|
|
629
631
|
},
|
|
630
632
|
suggest(context, prefix) {
|
|
631
|
-
if (isAsync) return suggestOptionAsync(optionNames$1, valueParser, require_usage.isSuggestionHidden(options.hidden), context, prefix);
|
|
632
|
-
return suggestOptionSync(optionNames$1, valueParser, require_usage.isSuggestionHidden(options.hidden), context, prefix);
|
|
633
|
+
if (isAsync) return suggestOptionAsync(optionNames$1, valueParser, require_usage.isSuggestionHidden(options.hidden), options.description, context, prefix);
|
|
634
|
+
return suggestOptionSync(optionNames$1, valueParser, require_usage.isSuggestionHidden(options.hidden), options.description, context, prefix);
|
|
633
635
|
},
|
|
634
636
|
getDocFragments(_state, defaultValue) {
|
|
635
637
|
if (require_usage.isDocHidden(options.hidden)) return {
|
|
@@ -910,7 +912,8 @@ function flag(...args) {
|
|
|
910
912
|
if (prefix === "-" && optionName$1.length !== 2) continue;
|
|
911
913
|
suggestions.push({
|
|
912
914
|
kind: "literal",
|
|
913
|
-
text: optionName$1
|
|
915
|
+
text: optionName$1,
|
|
916
|
+
...options.description && { description: options.description }
|
|
914
917
|
});
|
|
915
918
|
}
|
|
916
919
|
}
|
|
@@ -1427,10 +1430,11 @@ function* suggestCommandSync(context, prefix, name, aliases, parser, options) {
|
|
|
1427
1430
|
if (require_usage.isSuggestionHidden(options.hidden)) return;
|
|
1428
1431
|
const state = normalizeCommandState(context.state);
|
|
1429
1432
|
if (state === void 0) {
|
|
1433
|
+
const description = options.brief ?? options.description;
|
|
1430
1434
|
for (const commandName of [name, ...aliases]) if (commandName.startsWith(prefix)) yield {
|
|
1431
1435
|
kind: "literal",
|
|
1432
1436
|
text: commandName,
|
|
1433
|
-
...
|
|
1437
|
+
...description && { description }
|
|
1434
1438
|
};
|
|
1435
1439
|
} else if (state[0] === "matched") yield* parser.suggest(require_execution_context.withChildContext(context, name, getCommandChildState(context.state, parser.initialState, parser), parser.usage), prefix);
|
|
1436
1440
|
else if (state[0] === "parsing") yield* parser.suggest(require_execution_context.withChildContext(context, name, getCommandChildState(context.state, state[1], parser), parser.usage), prefix);
|
|
@@ -1439,10 +1443,11 @@ async function* suggestCommandAsync(context, prefix, name, aliases, parser, opti
|
|
|
1439
1443
|
if (require_usage.isSuggestionHidden(options.hidden)) return;
|
|
1440
1444
|
const state = normalizeCommandState(context.state);
|
|
1441
1445
|
if (state === void 0) {
|
|
1446
|
+
const description = options.brief ?? options.description;
|
|
1442
1447
|
for (const commandName of [name, ...aliases]) if (commandName.startsWith(prefix)) yield {
|
|
1443
1448
|
kind: "literal",
|
|
1444
1449
|
text: commandName,
|
|
1445
|
-
...
|
|
1450
|
+
...description && { description }
|
|
1446
1451
|
};
|
|
1447
1452
|
} else if (state[0] === "matched") {
|
|
1448
1453
|
const suggestions = parser.suggest(require_execution_context.withChildContext(context, name, getCommandChildState(context.state, parser.initialState, parser), parser.usage), prefix);
|
package/dist/primitives.js
CHANGED
|
@@ -247,7 +247,7 @@ function* getSuggestionsWithDependency(valueParser, prefix, dependencyRegistry,
|
|
|
247
247
|
* Internal sync helper for option suggest functionality.
|
|
248
248
|
* @internal
|
|
249
249
|
*/
|
|
250
|
-
function* suggestOptionSync(optionNames$1, valueParser, hidden, context, prefix) {
|
|
250
|
+
function* suggestOptionSync(optionNames$1, valueParser, hidden, description, context, prefix) {
|
|
251
251
|
if (hidden) return;
|
|
252
252
|
const equalsIndex = prefix.indexOf("=");
|
|
253
253
|
if (equalsIndex >= 0) {
|
|
@@ -275,7 +275,8 @@ function* suggestOptionSync(optionNames$1, valueParser, hidden, context, prefix)
|
|
|
275
275
|
if (prefix === "-" && optionName$1.length !== 2) continue;
|
|
276
276
|
yield {
|
|
277
277
|
kind: "literal",
|
|
278
|
-
text: optionName$1
|
|
278
|
+
text: optionName$1,
|
|
279
|
+
...description && { description }
|
|
279
280
|
};
|
|
280
281
|
}
|
|
281
282
|
}
|
|
@@ -331,7 +332,7 @@ async function* getSuggestionsWithDependencyAsync(valueParser, prefix, dependenc
|
|
|
331
332
|
* Internal async helper for option suggest functionality.
|
|
332
333
|
* @internal
|
|
333
334
|
*/
|
|
334
|
-
async function* suggestOptionAsync(optionNames$1, valueParser, hidden, context, prefix) {
|
|
335
|
+
async function* suggestOptionAsync(optionNames$1, valueParser, hidden, description, context, prefix) {
|
|
335
336
|
if (hidden) return;
|
|
336
337
|
const equalsIndex = prefix.indexOf("=");
|
|
337
338
|
if (equalsIndex >= 0) {
|
|
@@ -359,7 +360,8 @@ async function* suggestOptionAsync(optionNames$1, valueParser, hidden, context,
|
|
|
359
360
|
if (prefix === "-" && optionName$1.length !== 2) continue;
|
|
360
361
|
yield {
|
|
361
362
|
kind: "literal",
|
|
362
|
-
text: optionName$1
|
|
363
|
+
text: optionName$1,
|
|
364
|
+
...description && { description }
|
|
363
365
|
};
|
|
364
366
|
}
|
|
365
367
|
}
|
|
@@ -628,8 +630,8 @@ function option(...args) {
|
|
|
628
630
|
return dispatchByMode(mode, completeSync, completeAsync);
|
|
629
631
|
},
|
|
630
632
|
suggest(context, prefix) {
|
|
631
|
-
if (isAsync) return suggestOptionAsync(optionNames$1, valueParser, isSuggestionHidden(options.hidden), context, prefix);
|
|
632
|
-
return suggestOptionSync(optionNames$1, valueParser, isSuggestionHidden(options.hidden), context, prefix);
|
|
633
|
+
if (isAsync) return suggestOptionAsync(optionNames$1, valueParser, isSuggestionHidden(options.hidden), options.description, context, prefix);
|
|
634
|
+
return suggestOptionSync(optionNames$1, valueParser, isSuggestionHidden(options.hidden), options.description, context, prefix);
|
|
633
635
|
},
|
|
634
636
|
getDocFragments(_state, defaultValue) {
|
|
635
637
|
if (isDocHidden(options.hidden)) return {
|
|
@@ -910,7 +912,8 @@ function flag(...args) {
|
|
|
910
912
|
if (prefix === "-" && optionName$1.length !== 2) continue;
|
|
911
913
|
suggestions.push({
|
|
912
914
|
kind: "literal",
|
|
913
|
-
text: optionName$1
|
|
915
|
+
text: optionName$1,
|
|
916
|
+
...options.description && { description: options.description }
|
|
914
917
|
});
|
|
915
918
|
}
|
|
916
919
|
}
|
|
@@ -1427,10 +1430,11 @@ function* suggestCommandSync(context, prefix, name, aliases, parser, options) {
|
|
|
1427
1430
|
if (isSuggestionHidden(options.hidden)) return;
|
|
1428
1431
|
const state = normalizeCommandState(context.state);
|
|
1429
1432
|
if (state === void 0) {
|
|
1433
|
+
const description = options.brief ?? options.description;
|
|
1430
1434
|
for (const commandName of [name, ...aliases]) if (commandName.startsWith(prefix)) yield {
|
|
1431
1435
|
kind: "literal",
|
|
1432
1436
|
text: commandName,
|
|
1433
|
-
...
|
|
1437
|
+
...description && { description }
|
|
1434
1438
|
};
|
|
1435
1439
|
} else if (state[0] === "matched") yield* parser.suggest(withChildContext(context, name, getCommandChildState(context.state, parser.initialState, parser), parser.usage), prefix);
|
|
1436
1440
|
else if (state[0] === "parsing") yield* parser.suggest(withChildContext(context, name, getCommandChildState(context.state, state[1], parser), parser.usage), prefix);
|
|
@@ -1439,10 +1443,11 @@ async function* suggestCommandAsync(context, prefix, name, aliases, parser, opti
|
|
|
1439
1443
|
if (isSuggestionHidden(options.hidden)) return;
|
|
1440
1444
|
const state = normalizeCommandState(context.state);
|
|
1441
1445
|
if (state === void 0) {
|
|
1446
|
+
const description = options.brief ?? options.description;
|
|
1442
1447
|
for (const commandName of [name, ...aliases]) if (commandName.startsWith(prefix)) yield {
|
|
1443
1448
|
kind: "literal",
|
|
1444
1449
|
text: commandName,
|
|
1445
|
-
...
|
|
1450
|
+
...description && { description }
|
|
1446
1451
|
};
|
|
1447
1452
|
} else if (state[0] === "matched") {
|
|
1448
1453
|
const suggestions = parser.suggest(withChildContext(context, name, getCommandChildState(context.state, parser.initialState, parser), parser.usage), prefix);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Type-safe combinatorial command-line interface parser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -200,7 +200,7 @@
|
|
|
200
200
|
"fast-check": "^4.7.0",
|
|
201
201
|
"tsdown": "^0.13.0",
|
|
202
202
|
"typescript": "^5.8.3",
|
|
203
|
-
"@optique/env": "1.1.
|
|
203
|
+
"@optique/env": "1.1.2"
|
|
204
204
|
},
|
|
205
205
|
"scripts": {
|
|
206
206
|
"build": "tsdown",
|