@optique/clack 1.2.0-dev.2194 → 1.2.0-dev.2196

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/dist/index.js +12 -0
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -60,6 +60,7 @@ async function executePromptRaw(config) {
60
60
  if ("prompter" in cfg && cfg.prompter != null) {
61
61
  const value = await cfg.prompter();
62
62
  if (cfg.type === "number") return normalizeNumberResult(value);
63
+ if (cfg.type === "multiselect") return normalizeMultiselectResult(value, cfg);
63
64
  return {
64
65
  success: true,
65
66
  value
@@ -71,6 +72,7 @@ async function executePromptRaw(config) {
71
72
  error: message`Prompt cancelled.`
72
73
  };
73
74
  if (cfg.type === "number") return normalizeNumberResult(result);
75
+ if (cfg.type === "multiselect") return normalizeMultiselectResult(result, cfg);
74
76
  return {
75
77
  success: true,
76
78
  value: result
@@ -131,6 +133,16 @@ function normalizeNumberResult(result) {
131
133
  value: parsed
132
134
  };
133
135
  }
136
+ function normalizeMultiselectResult(result, config) {
137
+ if (config.required === true && Array.isArray(result) && result.length < 1) return {
138
+ success: false,
139
+ error: message`No option selected.`
140
+ };
141
+ return {
142
+ success: true,
143
+ value: result
144
+ };
145
+ }
134
146
  function parseNumberPromptValue(value) {
135
147
  if (value.trim() === "") return null;
136
148
  const parsed = Number(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/clack",
3
- "version": "1.2.0-dev.2194",
3
+ "version": "1.2.0-dev.2196",
4
4
  "description": "Interactive prompt support for Optique via Clack",
5
5
  "keywords": [
6
6
  "CLI",
@@ -57,16 +57,16 @@
57
57
  "sideEffects": false,
58
58
  "dependencies": {
59
59
  "@clack/prompts": "^1.6.0",
60
- "@optique/prompt": "1.2.0-dev.2194+96000f1d",
61
- "@optique/core": "1.2.0-dev.2194+96000f1d"
60
+ "@optique/core": "1.2.0-dev.2196+93daad17",
61
+ "@optique/prompt": "1.2.0-dev.2196+93daad17"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@types/node": "^24.0.0",
65
65
  "fast-check": "^4.7.0",
66
66
  "tsdown": "^0.13.0",
67
67
  "typescript": "^5.8.3",
68
- "@optique/run": "1.2.0-dev.2194+96000f1d",
69
- "@optique/env": "1.2.0-dev.2194+96000f1d"
68
+ "@optique/env": "1.2.0-dev.2196+93daad17",
69
+ "@optique/run": "1.2.0-dev.2196+93daad17"
70
70
  },
71
71
  "scripts": {
72
72
  "build": "tsdown",