MCPcopy Index your code
hub / github.com/ByBrawe/opencode-loop / takeFlagValue

Function takeFlagValue

src/index.js:119–125  ·  view source on GitHub ↗
(rest, flag)

Source from the content-addressed store, hash-verified

117}
118
119function takeFlag(rest, flag) {
120 const pattern = new RegExp(`(^|\\s)${escapeRegExp(flag)}(?=\\s|$)`, "i")
121 const found = pattern.test(rest)
122 return [found, rest.replace(pattern, " ").replace(/\s+/g, " ").trim()]
123}
124
125function takeFlagValue(rest, flag) {
126 const pattern = new RegExp(`(^|\\s)${escapeRegExp(flag)}\\s+(?:\"([^\"]*)\"|'([^']*)'|(\\S+))`, "i")
127 const match = rest.match(pattern)
128 if (!match) return [undefined, rest]

Callers 2

takeAllFlagValuesFunction · 0.85
parseLoopArgsFunction · 0.85

Calls 1

escapeRegExpFunction · 0.85

Tested by

no test coverage detected