@optique/core 1.3.6 → 1.3.7-dev.3001
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 +20 -7
- package/dist/primitives.d.cts +20 -7
- package/dist/primitives.d.ts +20 -7
- package/dist/primitives.js +20 -7
- package/package.json +2 -2
- package/skills/optique/SKILL.md +2 -2
package/dist/primitives.cjs
CHANGED
|
@@ -1803,16 +1803,29 @@ function command(name, parser, options = {}) {
|
|
|
1803
1803
|
* // mycli --debug --foo bar
|
|
1804
1804
|
* // → { debug: true, extra: ["--foo", "bar"] }
|
|
1805
1805
|
*
|
|
1806
|
-
* // greedy format:
|
|
1807
|
-
* const parser = command("exec",
|
|
1808
|
-
*
|
|
1809
|
-
*
|
|
1810
|
-
* })
|
|
1806
|
+
* // greedy format: require a program name before capturing the rest
|
|
1807
|
+
* const parser = command("exec", map(
|
|
1808
|
+
* seq(
|
|
1809
|
+
* argument(string({ metavar: "PROGRAM" })),
|
|
1810
|
+
* passThrough({ format: "greedy" }),
|
|
1811
|
+
* ),
|
|
1812
|
+
* ([program, args]) => ({ program, args }),
|
|
1813
|
+
* ));
|
|
1811
1814
|
*
|
|
1812
|
-
* // myproxy exec
|
|
1813
|
-
* // → {
|
|
1815
|
+
* // myproxy exec my-program --help
|
|
1816
|
+
* // → { program: "my-program", args: ["--help"] }
|
|
1814
1817
|
* ```
|
|
1815
1818
|
*
|
|
1819
|
+
* With built-in help enabled, `myproxy exec --help` displays help because `seq()`
|
|
1820
|
+
* does not reach pass-through until the program name is parsed. After the
|
|
1821
|
+
* program name, greedy capture can consume remaining tokens, including
|
|
1822
|
+
* `--help`, so they can be forwarded. Putting this parser last in an `object()`
|
|
1823
|
+
* does not establish the same boundary: fields are tried by priority, not
|
|
1824
|
+
* declaration order.
|
|
1825
|
+
* An immediate `--` after the program name is consumed by `seq()` as an
|
|
1826
|
+
* options terminator before greedy capture starts. Once capture starts,
|
|
1827
|
+
* subsequent `--` tokens are kept.
|
|
1828
|
+
*
|
|
1816
1829
|
* @since 0.8.0
|
|
1817
1830
|
*/
|
|
1818
1831
|
function passThrough(options = {}) {
|
package/dist/primitives.d.cts
CHANGED
|
@@ -584,16 +584,29 @@ interface PassThroughOptions {
|
|
|
584
584
|
* // mycli --debug --foo bar
|
|
585
585
|
* // → { debug: true, extra: ["--foo", "bar"] }
|
|
586
586
|
*
|
|
587
|
-
* // greedy format:
|
|
588
|
-
* const parser = command("exec",
|
|
589
|
-
*
|
|
590
|
-
*
|
|
591
|
-
* })
|
|
587
|
+
* // greedy format: require a program name before capturing the rest
|
|
588
|
+
* const parser = command("exec", map(
|
|
589
|
+
* seq(
|
|
590
|
+
* argument(string({ metavar: "PROGRAM" })),
|
|
591
|
+
* passThrough({ format: "greedy" }),
|
|
592
|
+
* ),
|
|
593
|
+
* ([program, args]) => ({ program, args }),
|
|
594
|
+
* ));
|
|
592
595
|
*
|
|
593
|
-
* // myproxy exec
|
|
594
|
-
* // → {
|
|
596
|
+
* // myproxy exec my-program --help
|
|
597
|
+
* // → { program: "my-program", args: ["--help"] }
|
|
595
598
|
* ```
|
|
596
599
|
*
|
|
600
|
+
* With built-in help enabled, `myproxy exec --help` displays help because `seq()`
|
|
601
|
+
* does not reach pass-through until the program name is parsed. After the
|
|
602
|
+
* program name, greedy capture can consume remaining tokens, including
|
|
603
|
+
* `--help`, so they can be forwarded. Putting this parser last in an `object()`
|
|
604
|
+
* does not establish the same boundary: fields are tried by priority, not
|
|
605
|
+
* declaration order.
|
|
606
|
+
* An immediate `--` after the program name is consumed by `seq()` as an
|
|
607
|
+
* options terminator before greedy capture starts. Once capture starts,
|
|
608
|
+
* subsequent `--` tokens are kept.
|
|
609
|
+
*
|
|
597
610
|
* @since 0.8.0
|
|
598
611
|
*/
|
|
599
612
|
declare function passThrough(options?: PassThroughOptions): FluentParser<"sync", readonly string[], readonly string[]>;
|
package/dist/primitives.d.ts
CHANGED
|
@@ -584,16 +584,29 @@ interface PassThroughOptions {
|
|
|
584
584
|
* // mycli --debug --foo bar
|
|
585
585
|
* // → { debug: true, extra: ["--foo", "bar"] }
|
|
586
586
|
*
|
|
587
|
-
* // greedy format:
|
|
588
|
-
* const parser = command("exec",
|
|
589
|
-
*
|
|
590
|
-
*
|
|
591
|
-
* })
|
|
587
|
+
* // greedy format: require a program name before capturing the rest
|
|
588
|
+
* const parser = command("exec", map(
|
|
589
|
+
* seq(
|
|
590
|
+
* argument(string({ metavar: "PROGRAM" })),
|
|
591
|
+
* passThrough({ format: "greedy" }),
|
|
592
|
+
* ),
|
|
593
|
+
* ([program, args]) => ({ program, args }),
|
|
594
|
+
* ));
|
|
592
595
|
*
|
|
593
|
-
* // myproxy exec
|
|
594
|
-
* // → {
|
|
596
|
+
* // myproxy exec my-program --help
|
|
597
|
+
* // → { program: "my-program", args: ["--help"] }
|
|
595
598
|
* ```
|
|
596
599
|
*
|
|
600
|
+
* With built-in help enabled, `myproxy exec --help` displays help because `seq()`
|
|
601
|
+
* does not reach pass-through until the program name is parsed. After the
|
|
602
|
+
* program name, greedy capture can consume remaining tokens, including
|
|
603
|
+
* `--help`, so they can be forwarded. Putting this parser last in an `object()`
|
|
604
|
+
* does not establish the same boundary: fields are tried by priority, not
|
|
605
|
+
* declaration order.
|
|
606
|
+
* An immediate `--` after the program name is consumed by `seq()` as an
|
|
607
|
+
* options terminator before greedy capture starts. Once capture starts,
|
|
608
|
+
* subsequent `--` tokens are kept.
|
|
609
|
+
*
|
|
597
610
|
* @since 0.8.0
|
|
598
611
|
*/
|
|
599
612
|
declare function passThrough(options?: PassThroughOptions): FluentParser<"sync", readonly string[], readonly string[]>;
|
package/dist/primitives.js
CHANGED
|
@@ -1803,16 +1803,29 @@ function command(name, parser, options = {}) {
|
|
|
1803
1803
|
* // mycli --debug --foo bar
|
|
1804
1804
|
* // → { debug: true, extra: ["--foo", "bar"] }
|
|
1805
1805
|
*
|
|
1806
|
-
* // greedy format:
|
|
1807
|
-
* const parser = command("exec",
|
|
1808
|
-
*
|
|
1809
|
-
*
|
|
1810
|
-
* })
|
|
1806
|
+
* // greedy format: require a program name before capturing the rest
|
|
1807
|
+
* const parser = command("exec", map(
|
|
1808
|
+
* seq(
|
|
1809
|
+
* argument(string({ metavar: "PROGRAM" })),
|
|
1810
|
+
* passThrough({ format: "greedy" }),
|
|
1811
|
+
* ),
|
|
1812
|
+
* ([program, args]) => ({ program, args }),
|
|
1813
|
+
* ));
|
|
1811
1814
|
*
|
|
1812
|
-
* // myproxy exec
|
|
1813
|
-
* // → {
|
|
1815
|
+
* // myproxy exec my-program --help
|
|
1816
|
+
* // → { program: "my-program", args: ["--help"] }
|
|
1814
1817
|
* ```
|
|
1815
1818
|
*
|
|
1819
|
+
* With built-in help enabled, `myproxy exec --help` displays help because `seq()`
|
|
1820
|
+
* does not reach pass-through until the program name is parsed. After the
|
|
1821
|
+
* program name, greedy capture can consume remaining tokens, including
|
|
1822
|
+
* `--help`, so they can be forwarded. Putting this parser last in an `object()`
|
|
1823
|
+
* does not establish the same boundary: fields are tried by priority, not
|
|
1824
|
+
* declaration order.
|
|
1825
|
+
* An immediate `--` after the program name is consumed by `seq()` as an
|
|
1826
|
+
* options terminator before greedy capture starts. Once capture starts,
|
|
1827
|
+
* subsequent `--` tokens are kept.
|
|
1828
|
+
*
|
|
1816
1829
|
* @since 0.8.0
|
|
1817
1830
|
*/
|
|
1818
1831
|
function passThrough(options = {}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/core",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.7-dev.3001",
|
|
4
4
|
"description": "Type-safe combinatorial command-line interface parser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -237,7 +237,7 @@
|
|
|
237
237
|
},
|
|
238
238
|
"sideEffects": false,
|
|
239
239
|
"devDependencies": {
|
|
240
|
-
"@optique/env": "1.3.
|
|
240
|
+
"@optique/env": "1.3.7-dev.3001+a1175c5b",
|
|
241
241
|
"@types/node": "^24.0.0",
|
|
242
242
|
"fast-check": "^4.7.0",
|
|
243
243
|
"tsdown": "^0.13.0",
|
package/skills/optique/SKILL.md
CHANGED
|
@@ -243,8 +243,8 @@ Common mistakes checklist
|
|
|
243
243
|
`withDefault(..., false)` for ordinary optional flags.
|
|
244
244
|
- Do not expect `multiple(p)` to fail when absent; it returns `[]`. Wrap with
|
|
245
245
|
`nonEmpty()` when at least one value is required.
|
|
246
|
-
-
|
|
247
|
-
|
|
246
|
+
- For ordered grammars, use `seq()`; `object()` fields compete by priority.
|
|
247
|
+
In wrappers, require the program name before greedy `passThrough()`.
|
|
248
248
|
- Do not concatenate plain strings for errors or descriptions. Use structured
|
|
249
249
|
`message` values.
|
|
250
250
|
- Register contexts for `bindEnv()`, `bindConfig()`, `bindDerivedDefault()`,
|