zx
Advanced tools
Comparing version 5.1.0 to 5.2.0
@@ -18,4 +18,6 @@ // Copyright 2021 Google LLC | ||
interface Echo { | ||
(pieces: TemplateStringsArray, ...args: any[]): Promise<void> | ||
(pieces: TemplateStringsArray, ...args: any[]): void | ||
(...args: any[]): void | ||
} | ||
export const echo: Echo | ||
@@ -25,4 +27,5 @@ interface Retry { | ||
} | ||
export const retry: (count: number) => Retry | ||
export const echo: Echo | ||
export const retry: (count: number) => Retry | ||
type StopSpinner = () => void | ||
export function startSpinner(title: string): StopSpinner |
@@ -48,3 +48,4 @@ // Copyright 2021 Google LLC | ||
export class ProcessOutput { | ||
readonly exitCode: number | ||
readonly exitCode: number | null | ||
readonly signal: NodeJS.Signals | null | ||
readonly stdout: string | ||
@@ -51,0 +52,0 @@ readonly stderr: string |
{ | ||
"name": "zx", | ||
"version": "5.1.0", | ||
"version": "5.2.0", | ||
"description": "A tool for writing better scripts.", | ||
@@ -26,3 +26,3 @@ "main": "./index.mjs", | ||
"chalk": "^5.0.0", | ||
"fs-extra": "^10.0.0", | ||
"fs-extra": "^10.0.1", | ||
"globby": "^13.1.1", | ||
@@ -29,0 +29,0 @@ "minimist": "^1.2.5", |
@@ -134,2 +134,3 @@ # 🐚 zx | ||
readonly exitCode: number | ||
readonly signal: 'SIGTERM' | 'SIGKILL' | ... | ||
toString(): string | ||
@@ -155,3 +156,3 @@ } | ||
```js | ||
let resp = await fetch('http://wttr.in') | ||
let resp = await fetch('https://wttr.in') | ||
if (resp.ok) { | ||
@@ -223,3 +224,17 @@ console.log(await resp.text()) | ||
``` | ||
#### `quiet()` | ||
Changes behavior of `$` to disable verbose output. | ||
```ts | ||
function quiet<P>(p: P): P | ||
``` | ||
Usage: | ||
```js | ||
await quiet($`grep something from-file`) | ||
// Command and output will not be displayed. | ||
``` | ||
### Packages | ||
@@ -360,3 +375,3 @@ | ||
#### ``echo`...` `` | ||
#### `echo()` | ||
@@ -369,5 +384,20 @@ A `console.log()` alternative which can take [ProcessOutput](#processoutput). | ||
let branch = await $`git branch --show-current` | ||
echo`Current branch is ${branch}.` | ||
// or | ||
echo('Current branch is', branch) | ||
``` | ||
#### `startSpinner()` | ||
Starts a simple CLI spinner, and returns `stop()` function. | ||
```js | ||
import {startSpinner} from 'zx/experimental' | ||
let stop = startSpinner() | ||
await $`long-running command` | ||
stop() | ||
``` | ||
### FAQ | ||
@@ -374,0 +404,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
50620
943
509
Updatedfs-extra@^10.0.1