Skip to content

Commit cb6f205

Browse files
docs: describe shell issues (google#1128)
* docs: describe shell issues closes google#1127 * chore: bump version to 8.4.1 * Update shell.md --------- Co-authored-by: Anton Medvedev <anton@medv.io>
1 parent 5c3b179 commit cb6f205

File tree

5 files changed

+31
-5
lines changed

5 files changed

+31
-5
lines changed

docs/.vitepress/config.mts

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export default defineConfig({
7575
link: '/faq',
7676
items: [
7777
{ text: 'Quotes', link: '/quotes' },
78+
{ text: 'Shell', link: '/shell' },
7879
{ text: 'TypeScript', link: '/typescript' },
7980
{ text: 'Markdown Scripts', link: '/markdown-scripts' },
8081
{ text: 'Known Issues', link: '/known-issues' },

docs/shell.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Shell
2+
3+
zx is not aimed to replace the shell, but to provide a more convenient way to use it through JavaScript enhancements. It supplements the shell with a more powerful and expressive language, so some kind of bash/zsh is still required.
4+
5+
zx provides several functions to help with setup:
6+
7+
* [`useBash`](./api#usebash) switches to bash
8+
* [`usePowerShell`](./api#usepowershell) - PowerShell
9+
* [`usePwsh`](./api#usepwsh) - pwsh (PowerShell v7+)
10+
11+
You can also set the shell directly via [JS API](./setup#bash), [CLI flags](./cli#shell) or [envars](./cli#environment-variables):
12+
13+
```js
14+
$.shell = '/bin/zsh'
15+
```
16+
17+
```bash
18+
zx --shell /bin/zsh script.js
19+
```
20+
21+
```bash
22+
ZX_SHELL=/bin/zsh zx script.js
23+
```

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zx",
3-
"version": "8.4.0",
3+
"version": "8.4.1",
44
"description": "A tool for writing better scripts",
55
"type": "module",
66
"main": "./build/index.cjs",

src/core.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -839,12 +839,14 @@ try {
839839

840840
function checkShell() {
841841
if (!$.shell)
842-
throw new Error(`No shell is available: https://ï.at/zx-no-shell`)
842+
throw new Error(`No shell is available: https://google.github.io/zx/shell`)
843843
}
844844

845845
function checkQuote() {
846846
if (!$.quote)
847-
throw new Error('No quote function is defined: https://ï.at/no-quote-func')
847+
throw new Error(
848+
'No quote function is defined: https://google.github.io/zx/quotes'
849+
)
848850
}
849851

850852
let cwdSyncHook: AsyncHook

0 commit comments

Comments
 (0)