INNER CODE UNIT · TypeScript

cli

x-cmd/x-cmd · mod/ajv/lib/ajv.ts:385

    const cli = Deno.args.slice(startIdx).filter((a) => a !== "" && !a.startsWith("--"));
    if (cli.length > 0) {
        for (const p of cli) yield* expandOne(p);
        return;
    }

    if (Deno.stdin.isTerminal()) {
        throw new Error("no input files (positional args or pipe via stdin)");
    }

    let buf = "";
    for await (const chunk of Deno.stdin.readable.pipeThrough(new TextDecoderStream())) {
        buf += chunk;
        let i;
        while ((i = buf.indexOf("\n")) >= 0) {
            const line = buf.slice(0, i).trim();
            buf = buf.slice(i + 1);
            if (line) yield line;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…