dsherret / dax

Cross-platform shell tools for Deno and Node.js inspired by zx.
MIT License
1.05k stars 35 forks source link

Add `$.setPrintCommand(true)` to mutate configuration of a `$` #22

Closed dsherret closed 2 years ago

dsherret commented 2 years ago

There are certain configuration settings that are useful to be able to mutate on an existing $ rather than constructing a new one. This mutable configuration should never be anything that could potentially break other code, but for logging purposes being able to modify if a command is printed to the console seems useful.

So instead of:

import { build$, CommandBuilder } from "...";

const $ = build$({
  commandBuilder: new CommandBuilder().printCommand(),
});

Users could do:

import { $ } from "...";

$.setPrintCommand(true);