@optique/core 1.2.0-dev.2346 → 1.2.1
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
|
@@ -248,7 +248,7 @@ function* getSuggestionsWithDependency(valueParser, prefix, dependencyRegistry,
|
|
|
248
248
|
* Internal sync helper for option suggest functionality.
|
|
249
249
|
* @internal
|
|
250
250
|
*/
|
|
251
|
-
function* suggestOptionSync(optionNames$1, valueParser, hidden, context, prefix) {
|
|
251
|
+
function* suggestOptionSync(optionNames$1, valueParser, hidden, description, context, prefix) {
|
|
252
252
|
if (hidden) return;
|
|
253
253
|
const equalsIndex = prefix.indexOf("=");
|
|
254
254
|
if (equalsIndex >= 0) {
|
|
@@ -276,7 +276,8 @@ function* suggestOptionSync(optionNames$1, valueParser, hidden, context, prefix)
|
|
|
276
276
|
if (prefix === "-" && optionName$1.length !== 2) continue;
|
|
277
277
|
yield {
|
|
278
278
|
kind: "literal",
|
|
279
|
-
text: optionName$1
|
|
279
|
+
text: optionName$1,
|
|
280
|
+
...description && { description }
|
|
280
281
|
};
|
|
281
282
|
}
|
|
282
283
|
}
|
|
@@ -332,7 +333,7 @@ async function* getSuggestionsWithDependencyAsync(valueParser, prefix, dependenc
|
|
|
332
333
|
* Internal async helper for option suggest functionality.
|
|
333
334
|
* @internal
|
|
334
335
|
*/
|
|
335
|
-
async function* suggestOptionAsync(optionNames$1, valueParser, hidden, context, prefix) {
|
|
336
|
+
async function* suggestOptionAsync(optionNames$1, valueParser, hidden, description, context, prefix) {
|
|
336
337
|
if (hidden) return;
|
|
337
338
|
const equalsIndex = prefix.indexOf("=");
|
|
338
339
|
if (equalsIndex >= 0) {
|
|
@@ -360,7 +361,8 @@ async function* suggestOptionAsync(optionNames$1, valueParser, hidden, context,
|
|
|
360
361
|
if (prefix === "-" && optionName$1.length !== 2) continue;
|
|
361
362
|
yield {
|
|
362
363
|
kind: "literal",
|
|
363
|
-
text: optionName$1
|
|
364
|
+
text: optionName$1,
|
|
365
|
+
...description && { description }
|
|
364
366
|
};
|
|
365
367
|
}
|
|
366
368
|
}
|
|
@@ -629,8 +631,8 @@ function option(...args) {
|
|
|
629
631
|
return require_mode_dispatch.dispatchByMode(mode, completeSync, completeAsync);
|
|
630
632
|
},
|
|
631
633
|
suggest(context, prefix) {
|
|
632
|
-
if (isAsync) return suggestOptionAsync(optionNames$1, valueParser, require_usage.isSuggestionHidden(options.hidden), context, prefix);
|
|
633
|
-
return suggestOptionSync(optionNames$1, valueParser, require_usage.isSuggestionHidden(options.hidden), context, prefix);
|
|
634
|
+
if (isAsync) return suggestOptionAsync(optionNames$1, valueParser, require_usage.isSuggestionHidden(options.hidden), options.description, context, prefix);
|
|
635
|
+
return suggestOptionSync(optionNames$1, valueParser, require_usage.isSuggestionHidden(options.hidden), options.description, context, prefix);
|
|
634
636
|
},
|
|
635
637
|
getDocFragments(_state, defaultValue) {
|
|
636
638
|
if (require_usage.isDocHidden(options.hidden)) return {
|
|
@@ -911,7 +913,8 @@ function flag(...args) {
|
|
|
911
913
|
if (prefix === "-" && optionName$1.length !== 2) continue;
|
|
912
914
|
suggestions.push({
|
|
913
915
|
kind: "literal",
|
|
914
|
-
text: optionName$1
|
|
916
|
+
text: optionName$1,
|
|
917
|
+
...options.description && { description: options.description }
|
|
915
918
|
});
|
|
916
919
|
}
|
|
917
920
|
}
|
|
@@ -1428,10 +1431,11 @@ function* suggestCommandSync(context, prefix, name, aliases, parser, options) {
|
|
|
1428
1431
|
if (require_usage.isSuggestionHidden(options.hidden)) return;
|
|
1429
1432
|
const state = normalizeCommandState(context.state);
|
|
1430
1433
|
if (state === void 0) {
|
|
1434
|
+
const description = options.brief ?? options.description;
|
|
1431
1435
|
for (const commandName of [name, ...aliases]) if (commandName.startsWith(prefix)) yield {
|
|
1432
1436
|
kind: "literal",
|
|
1433
1437
|
text: commandName,
|
|
1434
|
-
...
|
|
1438
|
+
...description && { description }
|
|
1435
1439
|
};
|
|
1436
1440
|
} else if (state[0] === "matched") yield* parser.suggest(require_execution_context.withChildContext(context, name, getCommandChildState(context.state, parser.initialState, parser), parser.usage), prefix);
|
|
1437
1441
|
else if (state[0] === "parsing") yield* parser.suggest(require_execution_context.withChildContext(context, name, getCommandChildState(context.state, state[1], parser), parser.usage), prefix);
|
|
@@ -1440,10 +1444,11 @@ async function* suggestCommandAsync(context, prefix, name, aliases, parser, opti
|
|
|
1440
1444
|
if (require_usage.isSuggestionHidden(options.hidden)) return;
|
|
1441
1445
|
const state = normalizeCommandState(context.state);
|
|
1442
1446
|
if (state === void 0) {
|
|
1447
|
+
const description = options.brief ?? options.description;
|
|
1443
1448
|
for (const commandName of [name, ...aliases]) if (commandName.startsWith(prefix)) yield {
|
|
1444
1449
|
kind: "literal",
|
|
1445
1450
|
text: commandName,
|
|
1446
|
-
...
|
|
1451
|
+
...description && { description }
|
|
1447
1452
|
};
|
|
1448
1453
|
} else if (state[0] === "matched") {
|
|
1449
1454
|
const suggestions = parser.suggest(require_execution_context.withChildContext(context, name, getCommandChildState(context.state, parser.initialState, parser), parser.usage), prefix);
|
package/dist/primitives.js
CHANGED
|
@@ -248,7 +248,7 @@ function* getSuggestionsWithDependency(valueParser, prefix, dependencyRegistry,
|
|
|
248
248
|
* Internal sync helper for option suggest functionality.
|
|
249
249
|
* @internal
|
|
250
250
|
*/
|
|
251
|
-
function* suggestOptionSync(optionNames$1, valueParser, hidden, context, prefix) {
|
|
251
|
+
function* suggestOptionSync(optionNames$1, valueParser, hidden, description, context, prefix) {
|
|
252
252
|
if (hidden) return;
|
|
253
253
|
const equalsIndex = prefix.indexOf("=");
|
|
254
254
|
if (equalsIndex >= 0) {
|
|
@@ -276,7 +276,8 @@ function* suggestOptionSync(optionNames$1, valueParser, hidden, context, prefix)
|
|
|
276
276
|
if (prefix === "-" && optionName$1.length !== 2) continue;
|
|
277
277
|
yield {
|
|
278
278
|
kind: "literal",
|
|
279
|
-
text: optionName$1
|
|
279
|
+
text: optionName$1,
|
|
280
|
+
...description && { description }
|
|
280
281
|
};
|
|
281
282
|
}
|
|
282
283
|
}
|
|
@@ -332,7 +333,7 @@ async function* getSuggestionsWithDependencyAsync(valueParser, prefix, dependenc
|
|
|
332
333
|
* Internal async helper for option suggest functionality.
|
|
333
334
|
* @internal
|
|
334
335
|
*/
|
|
335
|
-
async function* suggestOptionAsync(optionNames$1, valueParser, hidden, context, prefix) {
|
|
336
|
+
async function* suggestOptionAsync(optionNames$1, valueParser, hidden, description, context, prefix) {
|
|
336
337
|
if (hidden) return;
|
|
337
338
|
const equalsIndex = prefix.indexOf("=");
|
|
338
339
|
if (equalsIndex >= 0) {
|
|
@@ -360,7 +361,8 @@ async function* suggestOptionAsync(optionNames$1, valueParser, hidden, context,
|
|
|
360
361
|
if (prefix === "-" && optionName$1.length !== 2) continue;
|
|
361
362
|
yield {
|
|
362
363
|
kind: "literal",
|
|
363
|
-
text: optionName$1
|
|
364
|
+
text: optionName$1,
|
|
365
|
+
...description && { description }
|
|
364
366
|
};
|
|
365
367
|
}
|
|
366
368
|
}
|
|
@@ -629,8 +631,8 @@ function option(...args) {
|
|
|
629
631
|
return dispatchByMode(mode, completeSync, completeAsync);
|
|
630
632
|
},
|
|
631
633
|
suggest(context, prefix) {
|
|
632
|
-
if (isAsync) return suggestOptionAsync(optionNames$1, valueParser, isSuggestionHidden(options.hidden), context, prefix);
|
|
633
|
-
return suggestOptionSync(optionNames$1, valueParser, isSuggestionHidden(options.hidden), context, prefix);
|
|
634
|
+
if (isAsync) return suggestOptionAsync(optionNames$1, valueParser, isSuggestionHidden(options.hidden), options.description, context, prefix);
|
|
635
|
+
return suggestOptionSync(optionNames$1, valueParser, isSuggestionHidden(options.hidden), options.description, context, prefix);
|
|
634
636
|
},
|
|
635
637
|
getDocFragments(_state, defaultValue) {
|
|
636
638
|
if (isDocHidden(options.hidden)) return {
|
|
@@ -911,7 +913,8 @@ function flag(...args) {
|
|
|
911
913
|
if (prefix === "-" && optionName$1.length !== 2) continue;
|
|
912
914
|
suggestions.push({
|
|
913
915
|
kind: "literal",
|
|
914
|
-
text: optionName$1
|
|
916
|
+
text: optionName$1,
|
|
917
|
+
...options.description && { description: options.description }
|
|
915
918
|
});
|
|
916
919
|
}
|
|
917
920
|
}
|
|
@@ -1428,10 +1431,11 @@ function* suggestCommandSync(context, prefix, name, aliases, parser, options) {
|
|
|
1428
1431
|
if (isSuggestionHidden(options.hidden)) return;
|
|
1429
1432
|
const state = normalizeCommandState(context.state);
|
|
1430
1433
|
if (state === void 0) {
|
|
1434
|
+
const description = options.brief ?? options.description;
|
|
1431
1435
|
for (const commandName of [name, ...aliases]) if (commandName.startsWith(prefix)) yield {
|
|
1432
1436
|
kind: "literal",
|
|
1433
1437
|
text: commandName,
|
|
1434
|
-
...
|
|
1438
|
+
...description && { description }
|
|
1435
1439
|
};
|
|
1436
1440
|
} else if (state[0] === "matched") yield* parser.suggest(withChildContext(context, name, getCommandChildState(context.state, parser.initialState, parser), parser.usage), prefix);
|
|
1437
1441
|
else if (state[0] === "parsing") yield* parser.suggest(withChildContext(context, name, getCommandChildState(context.state, state[1], parser), parser.usage), prefix);
|
|
@@ -1440,10 +1444,11 @@ async function* suggestCommandAsync(context, prefix, name, aliases, parser, opti
|
|
|
1440
1444
|
if (isSuggestionHidden(options.hidden)) return;
|
|
1441
1445
|
const state = normalizeCommandState(context.state);
|
|
1442
1446
|
if (state === void 0) {
|
|
1447
|
+
const description = options.brief ?? options.description;
|
|
1443
1448
|
for (const commandName of [name, ...aliases]) if (commandName.startsWith(prefix)) yield {
|
|
1444
1449
|
kind: "literal",
|
|
1445
1450
|
text: commandName,
|
|
1446
|
-
...
|
|
1451
|
+
...description && { description }
|
|
1447
1452
|
};
|
|
1448
1453
|
} else if (state[0] === "matched") {
|
|
1449
1454
|
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.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Type-safe combinatorial command-line interface parser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -225,7 +225,7 @@
|
|
|
225
225
|
"fast-check": "^4.7.0",
|
|
226
226
|
"tsdown": "^0.13.0",
|
|
227
227
|
"typescript": "^5.8.3",
|
|
228
|
-
"@optique/env": "1.2.
|
|
228
|
+
"@optique/env": "1.2.1"
|
|
229
229
|
},
|
|
230
230
|
"scripts": {
|
|
231
231
|
"build": "tsdown",
|