Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n(zh-cn): Update cli-reference.mdx #10017

Merged
merged 4 commits into from
Nov 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 42 additions & 5 deletions src/content/docs/zh-cn/reference/cli-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Commands
add Add an integration.
build Build your project and write it to disk.
check Check your project for errors.
create-key Create a cryptography key
dev Start the development server.
docs Open documentation in your web browser.
info List info about your current Astro setup.
Expand All @@ -80,10 +81,46 @@ Global Flags
--verbose Enable verbose logging.
--silent Disable all logging.
--version Show the version number and exit.
--open Open the app in the browser on server start.
--help Show this help message.
```

你可以在任何命令后添加 `--help` 标志,以获取该命令的所有标志的列表。

<PackageManagerTabs>
<Fragment slot="npm">
```shell
# 获取 `dev` 命令的所有标志的列表
npm run dev -- --help
```
</Fragment>
<Fragment slot="pnpm">
```shell
# 获取 `dev` 命令的所有标志的列表
pnpm dev --help
```
</Fragment>
<Fragment slot="yarn">
```shell
# 获取 `dev` 命令的所有标志的列表
yarn dev --help
```
</Fragment>
</PackageManagerTabs>

下面的消息将在你的终端中显示:

```bash
astro dev [...flags]

Flags
--port Specify which port to run on. Defaults to 4321.
--host Listen on all addresses, including LAN and public addresses.
--host <custom-address> Expose on a network IP address at <custom-address>
--open Automatically open the app in the browser on server start
--force Clear the content layer cache, forcing a full rebuild.
--help (-h) See all available flags.
```

:::note
你需要在标志前添加 `--` 才能让 `npm` 把这些标志传递给 `astro` 命令。
:::
Expand Down Expand Up @@ -384,6 +421,10 @@ astro --config config/astro.config.mjs dev

启用静默日志,当你不想看到 Astro 日志时有用。

### `--open`

在服务器启动时自动在浏览器中打开应用程序。可以传递完整的 URL 字符串 (例如 `--open http://example.com`) 或路径名 (例如 `--open /about`) 来指定要打开的 URL。

## 全局标志

使用这些标志获取有关 `astro` CLI 的信息。
Expand All @@ -392,10 +433,6 @@ astro --config config/astro.config.mjs dev

打印 Astro 版本号并退出。

### `--open`

在服务器启动时自动在浏览器中打开应用程序。可以传递完整的 URL 字符串 (例如 `--open http://example.com`) 或路径名 (例如 `--open /about`) 来指定要打开的 URL。

### `--help`

打印帮助信息并退出。
Expand Down
Loading