@catladder/cli 4.0.0 → 4.0.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/bundles/catenv/index.js +1 -1
- package/dist/bundles/cli/index.js +2 -2
- package/dist/cli/src/adapters/terminal.js +10 -6
- package/dist/cli/src/adapters/terminal.js.map +1 -1
- package/dist/pipeline/src/constants.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/adapters/terminal.ts +12 -7
package/package.json
CHANGED
package/src/adapters/terminal.ts
CHANGED
|
@@ -146,17 +146,22 @@ class TerminalContext<
|
|
|
146
146
|
return jsonInputs[name] as InputResultType<P>;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
// 3.
|
|
150
|
-
if (isInteractive) {
|
|
151
|
-
return promptInteractive({ ...spec, name }, this);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// 4. Default
|
|
149
|
+
// 3. Default (check before prompting, so optional inputs with defaults don't prompt)
|
|
155
150
|
if ("default" in spec && spec.default !== undefined) {
|
|
156
151
|
return spec.default as InputResultType<P>;
|
|
157
152
|
}
|
|
158
153
|
|
|
159
|
-
//
|
|
154
|
+
// 4. Optional inputs: don't prompt, throw so baseContext returns undefined
|
|
155
|
+
if (spec.required === false) {
|
|
156
|
+
throw new MissingInputError(name, spec.message);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// 5. Interactive prompt
|
|
160
|
+
if (isInteractive) {
|
|
161
|
+
return promptInteractive({ ...spec, name }, this);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// 6. Throw
|
|
160
165
|
throw new MissingInputError(name, spec.message);
|
|
161
166
|
}
|
|
162
167
|
}
|