MCPcopy Create free account
hub / github.com/Effect-TS/effect / scanCommandLevel

Function scanCommandLevel

packages/effect/src/unstable/cli/internal/parser.ts:924–944  ·  view source on GitHub ↗
(
  tokens: ReadonlyArray<Token>,
  context: CommandContext
)

Source from the content-addressed store, hash-verified

922 * Returns LeafResult if no subcommand detected, SubcommandResult otherwise.
923 */
924const 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}

Callers 1

parseArgsFunction · 0.85

Calls 7

makeCursorFunction · 0.85
createParseStateFunction · 0.85
isFlagTokenFunction · 0.85
processFlagFunction · 0.85
processValueFunction · 0.85
toLeafResultFunction · 0.85
takeMethod · 0.65

Tested by

no test coverage detected