Closed impactaky closed 5 months ago
looks useful, I just happened to use this (+chatgpt added type declarations)
import { $, CommandBuilder } from "https://deno.land/x/dax@0.31.0/mod.ts";
declare module "https://deno.land/x/dax@0.31.0/mod.ts" {
interface CommandBuilder {
pipe(next: CommandBuilder): CommandBuilder;
}
}
CommandBuilder.prototype.pipe = function (
next: CommandBuilder,
): CommandBuilder {
const p = this.stdout("piped").spawn();
return next.stdin(p.stdout());
};
await $`curl https://nim-lang.org/choosenim/init.sh -sSf`.pipe($`sh -s -- -y`);
maybe this is a good addition until pipes in strings are supported (like "curl | sh")
and ideally something like .xargs("sh ${i} -y")
, though no idea for now how to make such thing work
Thank you!
I enhanced the Wrapper I wrote for myself and made it public. https://github.com/impactaky/dax_extras
I also thought about using the (string) => CommandBuilder
function for xargs and implemented it.
cool thanks as well
Hello,
Thanks for a great tool. I wanted to write neatly by chaining pipe() to command call.
I wrote the following code. This met my requirements. What do you think?