MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / parseCallHelpArgs

Function parseCallHelpArgs

apps/cli/src/main.ts:1618–1714  ·  view source on GitHub ↗
(args: ReadonlyArray<string>)

Source from the content-addressed store, hash-verified

1616const isHelpFlag = (value: string): boolean => HELP_FLAGS.has(value);
1617
1618const parseCallHelpArgs = (args: ReadonlyArray<string>): ParsedCallHelpArgs => {
1619 let baseUrl: string | undefined = undefined;
1620 let serverName: string | undefined = undefined;
1621 let scopeDir: string | undefined = undefined;
1622 let match: string | undefined = undefined;
1623 let limit: number | undefined = undefined;
1624 const pathParts: Array<string> = [];
1625
1626 for (let index = 0; index < args.length; index += 1) {
1627 const token = args[index];
1628 if (!token || isHelpFlag(token)) continue;
1629
1630 if (token === "--base-url") {
1631 const value = args[index + 1];
1632 if (!value) throw new Error("Missing value for --base-url");
1633 baseUrl = value;
1634 index += 1;
1635 continue;
1636 }
1637 if (token.startsWith("--base-url=")) {
1638 baseUrl = token.slice("--base-url=".length);
1639 continue;
1640 }
1641
1642 if (token === "--server") {
1643 const value = args[index + 1];
1644 if (!value) throw new Error("Missing value for --server");
1645 serverName = value;
1646 index += 1;
1647 continue;
1648 }
1649 if (token.startsWith("--server=")) {
1650 serverName = token.slice("--server=".length);
1651 continue;
1652 }
1653
1654 if (token === "--scope") {
1655 const value = args[index + 1];
1656 if (!value) throw new Error("Missing value for --scope");
1657 scopeDir = value;
1658 index += 1;
1659 continue;
1660 }
1661 if (token.startsWith("--scope=")) {
1662 scopeDir = token.slice("--scope=".length);
1663 continue;
1664 }
1665
1666 if (token === "--log-level") {
1667 const value = args[index + 1];
1668 if (!value) throw new Error("Missing value for --log-level");
1669 index += 1;
1670 continue;
1671 }
1672 if (token.startsWith("--log-level=")) {
1673 continue;
1674 }
1675

Callers 1

main.tsFile · 0.85

Calls 3

isHelpFlagFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected