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

Function scanCommandLevel

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

Source from the content-addressed store, hash-verified

970 * Returns LeafResult if no subcommand detected, SubcommandResult otherwise.
971 */
972const scanCommandLevel = (
973 tokens: ReadonlyArray<Token>,
974 context: CommandContext
975): LevelResult => {
976 const cursor = makeCursor(tokens)
977 const state = createParseState(context.flagRegistry)
978
979 for (let token = cursor.take(); token; token = cursor.take()) {
980 if (isFlagToken(token)) {
981 processFlag(token, cursor, context, state)
982 continue
983 }
984
985 if (token._tag === "Value") {
986 const subResult = processValue(token.value, cursor, context, state)
987 if (subResult) return subResult
988 }
989 }
990
991 return toLeafResult(state)
992}

Callers 2

parseArgsFunction · 0.85
getSelectedCommandTokensFunction · 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