zx icon indicating copy to clipboard operation
zx copied to clipboard

Echo only command output

Open antonmedv opened this issue 1 year ago • 5 comments

https://github.com/google/zx/issues/91#issuecomment-845787197

$.verbose = false
await $`program 2>&1`.pipe(process.stdout)

The only way I could get piped commands to actually be captured, and then output it, was the following, which I'm sure could be done better, but was the only thing that worked for me - note I did try using the

.pipe($`someCommand`) 

option, but no luck for me, lol! This allows me to just copy some stuff I try at the command line straight in as well, so not too bad :D

let it = (await $`cat db.template.sql | grep 'CREATE TABLE'`).stdout;
console.log(it);

Originally posted by @bradparks in https://github.com/google/zx/issues/91#issuecomment-1382831457

antonmedv avatar May 28 '23 06:05 antonmedv

I would like to Collaborator on this issue can you assign me this .

thekartikeyamishra avatar May 29 '23 19:05 thekartikeyamishra

I am planning a big refactoring in the v8 so it's better to leave it for me right now.

antonmedv avatar May 29 '23 20:05 antonmedv

Just came here to request this.

Instead of $.verbose there should be a separate $.echo (print commands as they are run) and $.quiet (don't show output).

stevage avatar Jun 20 '23 02:06 stevage

I am also interested in this feature. Otherwise it's not possible to quietly save values into variables. Its always printed out.

fabianmarcus avatar Sep 01 '23 15:09 fabianmarcus

I am planning a big refactoring in the v8 so it's better to leave it for me right now.

I am eagerly awaiting version 8. In the mean time, can we add this foot gun to the Known Issues?

Zamiell avatar Oct 28 '23 17:10 Zamiell