@mono-labs/cli 0.0.111 → 0.0.112
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.
|
@@ -57,10 +57,9 @@ export function buildCommands(files) {
|
|
|
57
57
|
let current = program
|
|
58
58
|
.command(commandName)
|
|
59
59
|
.description(configObject.description || 'Haste command');
|
|
60
|
-
|
|
60
|
+
const argInfo = configObject.argument;
|
|
61
61
|
// Argument
|
|
62
|
-
if (
|
|
63
|
-
const argInfo = configObject.argument;
|
|
62
|
+
if (argInfo) {
|
|
64
63
|
const required = !!argInfo.required;
|
|
65
64
|
const type = argInfo.type || 'string';
|
|
66
65
|
const argSpec = required ? `<${type}>` : `[${type}]`;
|
|
@@ -96,6 +95,14 @@ export function buildCommands(files) {
|
|
|
96
95
|
current.action(async (arg, cmd) => {
|
|
97
96
|
let envDefaults = {};
|
|
98
97
|
|
|
98
|
+
if (argInfo && argInfo.options && !argInfo.options.includes(arg)) {
|
|
99
|
+
throw new Error(
|
|
100
|
+
`Invalid argument value for ${commandName}, must be one of: ${argInfo.options.join(
|
|
101
|
+
', '
|
|
102
|
+
)}`
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
99
106
|
const optionsDataList = Object.keys(optionsData).map((key) => ({
|
|
100
107
|
...optionsData[key],
|
|
101
108
|
name: key,
|