The CLI's behaviour, with every runtime detail injected.
You only need this if you are embedding the command-line behaviour in
something other than Node — a test harness, a worker, a browser. To just get
the data, use extractExamples instead.
Example: Run the CLI against a string, capturing output
letout = ""; constcli = newZcapSpecExamplesCli({ fetch: (url) =>fetch(url), readStdin:async () =>html, // pretend this was piped in writeStdout: (chunk) => { out += chunk; }, writeStderr: (chunk) =>console.error(chunk), }); constexitCode = awaitcli.run({ format:"json" });
The CLI's behaviour, with every runtime detail injected.
You only need this if you are embedding the command-line behaviour in something other than Node — a test harness, a worker, a browser. To just get the data, use extractExamples instead.
Example: Run the CLI against a string, capturing output