MCPcopy Index your code
hub / github.com/continuedev/continue / getBooleanArg

Function getBooleanArg

core/tools/parseArgs.ts:133–153  ·  view source on GitHub ↗
(args: any, argName: string, required = false)

Source from the content-addressed store, hash-verified

131}
132
133export function getBooleanArg(args: any, argName: string, required = false) {
134 if (!args || !(argName in args)) {
135 if (required) {
136 throw new Error(`Argument \`${argName}\` is required (type boolean)`);
137 } else {
138 return undefined;
139 }
140 }
141 if (typeof args[argName] === "string") {
142 if (args[argName].toLowerCase() === "false") {
143 return false;
144 }
145 if (args[argName].toLowerCase() === "true") {
146 return true;
147 }
148 }
149 if (typeof args[argName] !== "boolean") {
150 throw new Error(`Argument \`${argName}\` must be a boolean true or false`);
151 }
152 return args[argName];
153}

Callers 3

runTerminalCommandImplFunction · 0.90
createRuleBlockImplFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected