@optique/inquirer 1.0.0-dev.0 → 1.0.0-dev.459

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.
Files changed (2) hide show
  1. package/README.md +81 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,81 @@
1
+ @optique/inquirer
2
+ =================
3
+
4
+ Interactive prompt support for [Optique] via [Inquirer.js].
5
+
6
+ This package wraps any Optique parser with an interactive prompt that fires
7
+ when no CLI value is provided. The fallback priority is:
8
+
9
+ CLI arguments > interactive prompt.
10
+
11
+ Because interactive prompts are inherently asynchronous, the returned parser
12
+ always has `$mode: "async"`.
13
+
14
+ [Optique]: https://optique.dev/
15
+ [Inquirer.js]: https://github.com/SBoudrias/Inquirer.js
16
+
17
+
18
+ Installation
19
+ ------------
20
+
21
+ ~~~~ bash
22
+ deno add jsr:@optique/inquirer
23
+ npm add @optique/inquirer
24
+ pnpm add @optique/inquirer
25
+ yarn add @optique/inquirer
26
+ bun add @optique/inquirer
27
+ ~~~~
28
+
29
+
30
+ Quick start
31
+ -----------
32
+
33
+ ~~~~ typescript
34
+ import { object } from "@optique/core/constructs";
35
+ import { option } from "@optique/core/primitives";
36
+ import { integer, string } from "@optique/core/valueparser";
37
+ import { prompt } from "@optique/inquirer";
38
+ import { run } from "@optique/run";
39
+
40
+ const parser = object({
41
+ name: prompt(option("--name", string()), {
42
+ type: "input",
43
+ message: "Enter your name:",
44
+ }),
45
+ port: prompt(option("--port", integer()), {
46
+ type: "number",
47
+ message: "Enter the port number:",
48
+ default: 3000,
49
+ }),
50
+ });
51
+
52
+ await run(parser);
53
+ ~~~~
54
+
55
+ When `--name` and `--port` are provided on the command line, the prompts are
56
+ skipped. When they are absent, the user sees interactive prompts.
57
+
58
+
59
+ Features
60
+ --------
61
+
62
+ - *Ten prompt types*: `input`, `password`, `number`, `confirm`, `select`,
63
+ `rawlist`, `expand`, `checkbox`, `editor`, and a custom `prompter` for
64
+ testing
65
+ - *Transparent composition* with `bindEnv()` and `bindConfig()` — the
66
+ prompt fires only when no higher-priority source supplies a value
67
+ - *Prompt-only values* via `prompt(fail<T>(), …)` when a value should not
68
+ be exposed as a CLI option
69
+ - *TTY-free testing* via the `prompter` escape hatch on every config type
70
+
71
+
72
+ Documentation
73
+ -------------
74
+
75
+ For full documentation, visit <https://optique.dev/integrations/inquirer>.
76
+
77
+
78
+ License
79
+ -------
80
+
81
+ MIT License. See [LICENSE](../../LICENSE) for details.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/inquirer",
3
- "version": "1.0.0-dev.0",
3
+ "version": "1.0.0-dev.459+c66b524d",
4
4
  "description": "Interactive prompt support for Optique via Inquirer.js",
5
5
  "keywords": [
6
6
  "CLI",
@@ -56,7 +56,7 @@
56
56
  "sideEffects": false,
57
57
  "dependencies": {
58
58
  "@inquirer/prompts": "^8.3.0",
59
- "@optique/core": "1.0.0"
59
+ "@optique/core": "1.0.0-dev.459+c66b524d"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@types/node": "^20.19.9",