@mono-labs/cli 0.0.111 → 0.0.113
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,26 @@ export function buildCommands(files) {
|
|
|
96
95
|
current.action(async (arg, cmd) => {
|
|
97
96
|
let envDefaults = {};
|
|
98
97
|
|
|
98
|
+
console.log(arg);
|
|
99
|
+
console.log(argInfo);
|
|
100
|
+
console.log(argInfo.options);
|
|
101
|
+
console.log(arg ?? argInfo.default);
|
|
102
|
+
console.log(
|
|
103
|
+
'logic calc',
|
|
104
|
+
!argInfo.options.includes(arg ?? argInfo.default)
|
|
105
|
+
);
|
|
106
|
+
if (
|
|
107
|
+
argInfo &&
|
|
108
|
+
argInfo.options &&
|
|
109
|
+
!argInfo.options.includes(arg ?? argInfo.default)
|
|
110
|
+
) {
|
|
111
|
+
throw new Error(
|
|
112
|
+
`Invalid argument value for ${commandName}, must be one of: ${argInfo.options.join(
|
|
113
|
+
', '
|
|
114
|
+
)}`
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
99
118
|
const optionsDataList = Object.keys(optionsData).map((key) => ({
|
|
100
119
|
...optionsData[key],
|
|
101
120
|
name: key,
|