google/zx
google/zx
Activity
Last release
Open issues
Open PRs
License
release notes
release notes
Published 6/19/2024
PatchContains new featuresNothing special today. We just keep improving the implementation.
import {$} from 'zx'
zx/cli exports its inners to allow more advanced usage.
Imagine, your own CLI tool that uses zx as a base:
#!/usr/bin/env node
import './index.mjs'
import {main} from 'zx/cli'
main()
const getFixedSizeArray = (size) => {
const arr = []
return new Proxy(arr, {
get: (target, prop) =>
prop === 'push' && arr.length >= size
? () => {}
: target[prop],
})
}
const store = {
stdout: getFixedSizeArray(1),
stderr: getFixedSizeArray(1),
stdall: getFixedSizeArray(0),
}
const p = await $({ store })`echo foo`
p.stdout.trim() // 'foo'
p.toString() // ''
ps:
import { ps } from 'zx'
const list1 = await ps()
const list2 = await tree()
// new methods
const list3 = ps.sync()
const list4 = tree.sync()
$.log accepts kind: 'custom' #834$.verbose and $.quiet modes internals #835quotePowerShell in docs #851async_hooks.createHook warning on bun #848release notes
Published 6/19/2024
PatchContains new featuresNothing special today. We just keep improving the implementation.
import {$} from 'zx'
zx/cli exports its inners to allow more advanced usage.
Imagine, your own CLI tool that uses zx as a base:
#!/usr/bin/env node
import './index.mjs'
import {main} from 'zx/cli'
main()
const getFixedSizeArray = (size) => {
const arr = []
return new Proxy(arr, {
get: (target, prop) =>
prop === 'push' && arr.length >= size
? () => {}
: target[prop],
})
}
const store = {
stdout: getFixedSizeArray(1),
stderr: getFixedSizeArray(1),
stdall: getFixedSizeArray(0),
}
const p = await $({ store })`echo foo`
p.stdout.trim() // 'foo'
p.toString() // ''
ps:
import { ps } from 'zx'
const list1 = await ps()
const list2 = await tree()
// new methods
const list3 = ps.sync()
const list4 = tree.sync()
$.log accepts kind: 'custom' #834$.verbose and $.quiet modes internals #835quotePowerShell in docs #851async_hooks.createHook warning on bun #848A tool for writing better scripts