Add shell completion support

This commit is contained in:
2026-05-06 20:34:43 +08:00
parent f7f5e2c67c
commit f2d0a83705
7 changed files with 319 additions and 1 deletions

View File

@@ -53,6 +53,7 @@ bin/gsp.exe
.\bin\gsp.exe graph page.lottery.main --root examples\lottery --format md --out .gsp\graph.md
.\bin\gsp.exe graph page.lottery.main --root examples\lottery --format canvas --out .gsp\graph.canvas
.\bin\gsp.exe stage-check --root examples\lottery --stage implement --out .gsp\stage-report.json
.\bin\gsp.exe completion powershell
```
输出文件:
@@ -139,6 +140,7 @@ gsp version
gsp init
gsp ai-init
gsp version
gsp completion install powershell
gsp validate
gsp index
gsp flatten <id>
@@ -174,3 +176,22 @@ project/
```bash
gsp init path/to/project --force
```
## 命令补全
输出补全脚本:
```bash
gsp completion powershell
gsp completion bash
gsp completion zsh
gsp completion fish
```
安装 PowerShell 补全:
```powershell
gsp completion install powershell
```
安装后重新打开 PowerShell`gsp <Tab>` 会补全子命令,`gsp graph --format <Tab>` 会补全格式,`gsp graph <Tab>` 会读取当前工程的 GSP id。