chore: tests for rule
This commit is contained in:
@@ -230,9 +230,9 @@ function tokenize(input: string): string[] {
|
||||
* parseCommandSchema('move <from: [x: string; y: string]> <to: string> [--all]')
|
||||
* parseCommandSchema('move <from> <to> [--speed: number = 10 -s]')
|
||||
*/
|
||||
export function parseCommandSchema(schemaStr: string): CommandSchema {
|
||||
export function parseCommandSchema(schemaStr: string, name?: string): CommandSchema {
|
||||
const schema: CommandSchema = {
|
||||
name: '',
|
||||
name: name ?? '',
|
||||
params: [],
|
||||
options: [],
|
||||
flags: [],
|
||||
@@ -243,9 +243,10 @@ export function parseCommandSchema(schemaStr: string): CommandSchema {
|
||||
return schema;
|
||||
}
|
||||
|
||||
schema.name = tokens[0];
|
||||
const startIdx = name !== undefined ? 0 : 1;
|
||||
schema.name = name ?? tokens[0];
|
||||
|
||||
let i = 1;
|
||||
let i = startIdx;
|
||||
while (i < tokens.length) {
|
||||
const token = tokens[i];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user