refactor: change CommandSchema's options/flags to be Records
This commit is contained in:
+2
-2
@@ -71,7 +71,7 @@ function commandMatchesSchema(command: Command, schema: CommandSchema): boolean
|
||||
return false;
|
||||
}
|
||||
|
||||
const requiredOptions = schema.options.filter(o => o.required);
|
||||
const requiredOptions = Object.values(schema.options).filter(o => o.required);
|
||||
for (const opt of requiredOptions) {
|
||||
const hasOption = opt.name in command.options || (opt.short && opt.short in command.options);
|
||||
if (!hasOption) {
|
||||
@@ -131,7 +131,7 @@ function handleGeneratorResult<T>(
|
||||
ctx.state = 'invoking';
|
||||
return invokeChildRule(host, yielded.rule, yielded.command, ctx as RuleContext<unknown>);
|
||||
} else {
|
||||
ctx.schema = parseYieldedSchema({ name: '', params: [], options: [], flags: [] });
|
||||
ctx.schema = parseYieldedSchema({ name: '', params: [], options: {}, flags: {} });
|
||||
ctx.state = 'yielded';
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user