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

Function parseCallHelpArgs

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

Source from the content-addressed store, hash-verified

1680const isHelpFlag = (value: string): boolean => HELP_FLAGS.has(value);
1681
1682const parseCallHelpArgs = (args: ReadonlyArray<string>): ParsedCallHelpArgs => {
1683 let baseUrl: string | undefined = undefined;
1684 let serverName: string | undefined = undefined;
1685 let scopeDir: string | undefined = undefined;
1686 let match: string | undefined = undefined;
1687 let limit: number | undefined = undefined;
1688 const pathParts: Array<string> = [];
1689
1690 for (let index = 0; index < args.length; index += 1) {
1691 const token = args[index];
1692 if (!token || isHelpFlag(token)) continue;
1693
1694 if (token === "--base-url") {
1695 const value = args[index + 1];
1696 if (!value) throw new Error("Missing value for --base-url");
1697 baseUrl = value;
1698 index += 1;
1699 continue;
1700 }
1701 if (token.startsWith("--base-url=")) {
1702 baseUrl = token.slice("--base-url=".length);
1703 continue;
1704 }
1705
1706 if (token === "--server") {
1707 const value = args[index + 1];
1708 if (!value) throw new Error("Missing value for --server");
1709 serverName = value;
1710 index += 1;
1711 continue;
1712 }
1713 if (token.startsWith("--server=")) {
1714 serverName = token.slice("--server=".length);
1715 continue;
1716 }
1717
1718 if (token === "--scope") {
1719 const value = args[index + 1];
1720 if (!value) throw new Error("Missing value for --scope");
1721 scopeDir = value;
1722 index += 1;
1723 continue;
1724 }
1725 if (token.startsWith("--scope=")) {
1726 scopeDir = token.slice("--scope=".length);
1727 continue;
1728 }
1729
1730 if (token === "--log-level") {
1731 const value = args[index + 1];
1732 if (!value) throw new Error("Missing value for --log-level");
1733 index += 1;
1734 continue;
1735 }
1736 if (token.startsWith("--log-level=")) {
1737 continue;
1738 }
1739

Callers 1

main.tsFile · 0.85

Calls 3

isHelpFlagFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected