@travetto/cli 3.0.0 → 3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/cli",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "CLI infrastructure for Travetto framework",
5
5
  "keywords": [
6
6
  "cli",
@@ -24,9 +24,9 @@
24
24
  "directory": "module/cli"
25
25
  },
26
26
  "dependencies": {
27
- "@travetto/base": "^3.0.0",
28
- "@travetto/terminal": "^3.0.0",
29
- "@travetto/worker": "^3.0.0",
27
+ "@travetto/base": "^3.0.1",
28
+ "@travetto/terminal": "^3.0.1",
29
+ "@travetto/worker": "^3.0.1",
30
30
  "commander": "^10.0.0"
31
31
  },
32
32
  "travetto": {
package/src/command.ts CHANGED
@@ -108,7 +108,13 @@ export abstract class CliCommand<V extends OptionMap = OptionMap> {
108
108
  // @ts-expect-error
109
109
  const config: T = {
110
110
  type: String,
111
- combine: (v: K, acc) => choices.includes(v) ? v : acc,
111
+ combine: (v: K, acc) => {
112
+ if (v && !choices.includes(v)) {
113
+ this.showHelp(`Invalid choice: ${v}. Supported values are: ${choices.join(', ')}`);
114
+ return this.exit(1);
115
+ }
116
+ return v ?? acc;
117
+ },
112
118
  choices,
113
119
  completion: true,
114
120
  ...cfg
File without changes