MCPcopy
hub / github.com/codeaashu/claude-code / extractFlag

Function extractFlag

src/main.tsx:739–759  ·  view source on GitHub ↗
(flag: string, opts: {
        hasValue?: boolean;
        as?: string;
      } = {})

Source from the content-addressed store, hash-verified

737 // (which persists under the remote's ~/.claude/projects/<cwd>/).
738 // --model controls which model the remote uses.
739 const extractFlag = (flag: string, opts: {
740 hasValue?: boolean;
741 as?: string;
742 } = {}) => {
743 const i = rawCliArgs.indexOf(flag);
744 if (i !== -1) {
745 _pendingSSH.extraCliArgs.push(opts.as ?? flag);
746 const val = rawCliArgs[i + 1];
747 if (opts.hasValue && val && !val.startsWith('-')) {
748 _pendingSSH.extraCliArgs.push(val);
749 rawCliArgs.splice(i, 2);
750 } else {
751 rawCliArgs.splice(i, 1);
752 }
753 }
754 const eqI = rawCliArgs.findIndex(a => a.startsWith(`${flag}=`));
755 if (eqI !== -1) {
756 _pendingSSH.extraCliArgs.push(opts.as ?? flag, rawCliArgs[eqI]!.slice(flag.length + 1));
757 rawCliArgs.splice(eqI, 1);
758 }
759 };
760 extractFlag('-c', {
761 as: '--continue'
762 });

Callers 1

mainFunction · 0.85

Calls 2

spliceMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected