MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / parseArgs

Function parseArgs

scripts/runtime-services-info.mjs:155–186  ·  view source on GitHub ↗
(argv)

Source from the content-addressed store, hash-verified

153// ─────────────────────────────────────────────────────────────────────────────
154
155export function parseArgs(argv) {
156 const options = { automation: {} };
157 for (let i = 0; i < argv.length; i++) {
158 const flag = argv[i];
159 switch (flag) {
160 case "--mode":
161 options.mode = argv[++i];
162 break;
163 case "--agent-host-alias":
164 options.agentHostAlias = argv[++i];
165 break;
166 case "--agent-server-url":
167 options.agentServerUrl = argv[++i] || undefined;
168 break;
169 case "--automation-url":
170 options.automation.url = argv[++i] || undefined;
171 break;
172 case "--automation-api-prefix":
173 options.automation.apiPrefix = argv[++i];
174 break;
175 case "--automation-auth-env":
176 options.automation.authEnvVar = argv[++i];
177 break;
178 default:
179 throw new Error(`Unknown flag: ${flag}`);
180 }
181 }
182 // Omit the automation entry entirely when no URL was supplied, rather than
183 // advertising a backend the agent cannot reach.
184 if (!options.automation.url) delete options.automation;
185 return options;
186}
187
188const isMainModule =
189 process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected