openclaw completion 生成 shell 补全脚本,并可选安装到 shell profile。
用法
openclaw completion # 生成 zsh 补全脚本(输出到 stdout)
openclaw completion --shell bash # 生成 bash 补全脚本
openclaw completion --shell fish # 生成 fish 补全脚本
openclaw completion --shell powershell # 生成 PowerShell 补全脚本
openclaw completion --install # 安装到 shell profile(zsh)
openclaw completion --shell fish --install # 安装 fish 补全
openclaw completion --write-state # 写入状态目录,不输出到 stdout
openclaw completion --shell bash --write-state选项
| 选项 | 说明 |
|---|---|
-s, --shell <shell> | 目标 shell:zsh、bash、powershell、fish(默认 zsh) |
-i, --install | 在 shell profile 中添加 source 行 |
--write-state | 将脚本写入 $OPENCLAW_STATE_DIR/completions,不打印到 stdout |
-y, --yes | 跳过安装确认提示 |
行为说明
- 不带
--install或--write-state时,脚本输出到 stdout(可手动重定向) --install在 shell profile 中写入 “OpenClaw Completion” 块,指向缓存的脚本文件- 补全生成时会预加载完整命令树,确保嵌套子命令也被包含
- 更新 OpenClaw 后,运行
openclaw completion --write-state刷新补全缓存
相关链接
- cli-update — 更新后刷新补全
- cli-secrets — CLI 命令参考