跳转到内容
本站为社区维护的非官方中文翻译,与 Cloudflare, Inc. 无关联。本站不提供账户登录,请勿在任何非官方站点输入您的 Cloudflare 账户信息。官方文档:developers.cloudflare.com

WranglerCommand

最后更新 查看 MarkdownAgent 设置

WranglerCommand 组件记录了给定命令的可用选项。

这是使用 cloudflare-docs 存储库 ↗中的 Wrangler 版本生成的。

导入

import { WranglerCommand } from "~/components";

用法

import { WranglerCommand } from "~/components";

<WranglerCommand
	command="deploy"
	description={"Deploy a [Worker](/workers/)"}
/>

<WranglerCommand command="d1 execute" />

<WranglerCommand command="deploy" cfCommand="deploy" />

<WranglerCommand
	command="d1 execute"
	cfCommand={["d1 query", "d1 raw"]}
	includeHiddenCf
/>

使用 ExtraFlagDetails

您可以使用 ExtraFlagDetails 组件为特定标志(flag)添加或替换帮助文本:

import { WranglerCommand } from "~/components";
import ExtraFlagDetails from "~/components/cf/ExtraFlagDetails.astro";

<WranglerCommand command="deploy">
	<ExtraFlagDetails key="dry-run">
		Additional details about the dry-run flag that will be appended to the
		original help text. Here is a [link](https://cloudflare.com) for more
		information.
	</ExtraFlagDetails>
	<ExtraFlagDetails key="compatibility-date" mode="replace">
		Custom help text that completely replaces the original description for this
		flag.
	</ExtraFlagDetails>
</WranglerCommand>

参数

  • command stringrequired
    • 命令的名称,例如 d1 execute。
  • headingLevel number(default: 2) optional
    • 页面上应添加命令名称的标题级别,即 h2 对应 2。
  • description stringoptional
    • 在命令标题下方渲染的描述。如果未设置,则默认使用 Wrangler 帮助 API 中指定的值。
  • cfCommand string | string[]optional
    • 一个或多个经过审查的等效 Cloudflare CLI 命令,不含 cf 前缀。提供此属性后会显示共享 CLI 选择器。请在页面正文中说明仅部分等效或不等效的工作流程。
  • includeHiddenCf boolean(default: false) optional
    • 允许显式指定已审查、但安装的 Cloudflare CLI 将其标记为隐藏的 cfCommand 值。

这篇文档对您有帮助吗?