Replies: 1 comment 1 reply
-
This is nothing cliffy specific but here is an example how you could do this: import { Command } from "https://deno.land/x/cliffy@v0.18.2/command/mod.ts";
await new Command()
.option("--stdin", "read from stdin")
.arguments("[path]")
.action(async ({ stdin }, path: string) => {
if (stdin || path === "-") {
await Deno.copy(Deno.stdin, Deno.stdout);
} else {
const file = await Deno.open(path);
await Deno.copy(file, Deno.stdout);
file.close();
}
})
.parse(); I think I will add some real world examples when I update the documentation. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'd like to be able to pipe the STDOUT of a unix command into the STDIN of a cliffy CLI command. Can you provide an example of how to do so?
The experience I am looking for would allow for usage like:
Thanks
Beta Was this translation helpful? Give feedback.
All reactions