diff --git a/README.md b/README.md index 4ac8b03..04ecc80 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,9 @@ const output = (await $.raw`${cmd} ${msg}`).toString().trim() // $ echo foo bar ``` +### `$.verbose` +Set to `false` by default. + ### `$.opt` Returns `$` with the specified preset. Aliased for `$.o`. ```js diff --git a/package.json b/package.json index f0e2538..a79d1ed 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "zx-extra": "./src/main/js/cli.mjs" }, "scripts": { - "test": "PATH=$(env -i bash -c 'echo $PATH') node ./src/main/js/cli.mjs ./src/test/js/test.mjs", + "test": "PATH=$(env -i bash -c 'echo $PATH') node ./src/main/js/cli.mjs ./src/test/js/test.mjs --quiet", "publish:byhand": "npm publish --no-git-tag-version", "publish:beta": "npm publish --no-git-tag-version --tag beta", "publish:rc": "npm publish --no-git-tag-version --tag rc" diff --git a/src/main/js/index.mjs b/src/main/js/index.mjs index b72e561..cc7b7a9 100644 --- a/src/main/js/index.mjs +++ b/src/main/js/index.mjs @@ -1,4 +1,4 @@ -import {$ as _$, quiet, ProcessPromise, within} from 'zx' +import {$ as _$, quiet, ProcessPromise, within, argv} from 'zx' import {isTemplateSignature, randomId} from './util.mjs' import {npmRunPath} from 'npm-run-path' import {DeepProxy} from '@qiwi/deep-proxy' @@ -25,6 +25,8 @@ export const $ = new DeepProxy(_$, ({DEFAULT, target: t, trapName, args}) => { export const ctx = (cb, ref = $) => within(() => cb(ref)) +$.verbose = false + $.raw = async (...args) => $.o({quote: v => v})(...args) // https://github.com/google/zx/pull/134 diff --git a/src/test/js/test.mjs b/src/test/js/test.mjs index 4c718c1..1c3de93 100644 --- a/src/test/js/test.mjs +++ b/src/test/js/test.mjs @@ -1,5 +1,10 @@ import {strict as assert} from 'node:assert' -import {$, semver, createHook, ip, tempy, tcping, sleep, ctx, copy, fs, path} from '../../main/js/index.mjs' +import {$, semver, createHook, ip, tempy, tcping, ctx, copy, fs, path} from '../../main/js/index.mjs' + +// $.verbose +{ + assert($.verbose === false) +} // $.raw {