( tokens: ReadonlyArray<Token>, context: CommandContext )
| 922 | * Returns LeafResult if no subcommand detected, SubcommandResult otherwise. |
| 923 | */ |
| 924 | const scanCommandLevel = ( |
| 925 | tokens: ReadonlyArray<Token>, |
| 926 | context: CommandContext |
| 927 | ): LevelResult => { |
| 928 | const cursor = makeCursor(tokens) |
| 929 | const state = createParseState(context.flagRegistry) |
| 930 | |
| 931 | for (let token = cursor.take(); token; token = cursor.take()) { |
| 932 | if (isFlagToken(token)) { |
| 933 | processFlag(token, cursor, context, state) |
| 934 | continue |
| 935 | } |
| 936 | |
| 937 | if (token._tag === "Value") { |
| 938 | const subResult = processValue(token.value, cursor, context, state) |
| 939 | if (subResult) return subResult |
| 940 | } |
| 941 | } |
| 942 | |
| 943 | return toLeafResult(state) |
| 944 | } |
no test coverage detected