Skip to content

Commit

Permalink
feat: set $.verbose to false by default
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Jul 5, 2022
1 parent 1f38a41 commit 2d398a0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion src/main/js/index.mjs
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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
Expand Down
7 changes: 6 additions & 1 deletion src/test/js/test.mjs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down

0 comments on commit 2d398a0

Please sign in to comment.