zx: $verbose = false is not displaying command output. verbose should be just for the command
Works for me.
⌘ zx ⎇ main ❯❯❯ cat foo.mjs
#!/usr/local/bin/node
import { $ } from './index.mjs'
$.verbose = false
await ($`uptime`)
⌘ zx ⎇ main ❯❯❯ node foo.mjs
⌘ zx ⎇ main ❯❯❯
_Originally posted by @antonmedv in https://github.com/google/zx/issues/80#issuecomment-841612690_
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 3
- Comments: 36
@adrianord for this specific case you need to do something like this:
Or if you want to redirect in to stderr:
Got something even more interesting:
I would be fine doing something like
personally. I think it’s unrealistic to for zx to be one to one with bash, but I’d like the option to not display the command that is being ran.
Please forgive me this is off-topic, but this is the only place I can post this.
I’ve been looking at proxy-www which I found on Modern Javascript: Everything you missed over the last 10 years (2020) via a post on hn wondering if it would be possible to simplify the syntax you demonstrated to something like this:
or even something like this, maybe (using Korn shell if available):
Again, apologies for the off-topic post. Your program is great, love the take on Knuth’s Literate Programming where you allow
zx examples/index.md@antonmedv commands that output stdout to show progress will only show their full output at the end of execution with the work around you are proposing, this is not desirable. With using verbose they output to stdout as they are running.
@antonmedv I’m OK with the pipeline method! Thanks!
This code already in the master branch and can be tested!