google / zx

A tool for writing better scripts
https://google.github.io/zx/
Apache License 2.0
42.91k stars 1.09k forks source link

Allow to initialize $ #600

Closed gajus closed 6 months ago

gajus commented 1 year ago

The current API feels awkward, whereby settings are applied after the command, i.e.

$`date`
  .nothrow()
  .quiet();

I'd like to be able to do something like

const $ = createZx({
  nothrow: true,
  queit: true,
});

$`date`
antongolub commented 1 year ago

I believe v8 will bring smth similar. Here's a proposal:

antonmedv commented 1 year ago

Yes, I'd like to refactor the api to allow more easy customizations.

$({nothrow: true})`cmd`