Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
antonmedv committed May 7, 2021
1 parent 4c8d602 commit c176b2b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ Specifies verbosity. Default: `true`.
In verbose mode prints executed commands with outputs of it. Same as
`set -x` in bash.

### Importing
### Importing from other scripts

It's possible to use `$` and others with explicit import.

Expand All @@ -196,6 +196,13 @@ import {$} from 'zx'
await $`date`
```

### Passing env variables

```js
process.env.FOO = 'bar'
await $`echo $FOO`
```

### Executing remote scripts

If arg to `zx` bin starts with `https://`, it will be downloaded and executed.
Expand Down
5 changes: 5 additions & 0 deletions test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,8 @@ function assert(cond, msg) {
}
assert(p.exitCode === 1)
}

{
process.env.FOO = 'hi; exit 1'
await $`echo $FOO`
}

0 comments on commit c176b2b

Please sign in to comment.