-
Notifications
You must be signed in to change notification settings - Fork 417
fix(cli): make completion command discoverable #307
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
base: main
Are you sure you want to change the base?
Changes from all commits
01533ab
5bbf1a4
4ed8387
70dbeb8
c9fe226
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -90,6 +90,19 @@ lark-cli auth login --recommend | |||||||||||||||||||||
| lark-cli calendar +agenda | ||||||||||||||||||||||
| ``` | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #### Optional: Shell Completion | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| `lark-cli completion` is available as a regular top-level command and does not require login. Generate a completion script for the shell you use most: | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||
| # Bash | ||||||||||||||||||||||
| lark-cli completion bash > ~/.local/share/bash-completion/completions/lark-cli | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Zsh | ||||||||||||||||||||||
| mkdir -p ~/.zfunc | ||||||||||||||||||||||
| lark-cli completion zsh > ~/.zfunc/_lark-cli | ||||||||||||||||||||||
| ``` | ||||||||||||||||||||||
|
Comment on lines
+101
to
+104
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The example writes a completion file to
Suggested change
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## Quick Start (AI Agent) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| > The following steps are for AI Agents. Some steps require the user to complete actions in a browser. | ||||||||||||||||||||||
|
|
@@ -126,6 +139,12 @@ lark-cli auth login --recommend | |||||||||||||||||||||
| lark-cli auth status | ||||||||||||||||||||||
| ``` | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Shell completion is also available without authentication: | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||
| lark-cli completion fish > ~/.config/fish/completions/lark-cli.fish | ||||||||||||||||||||||
| ``` | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## Agent Skills | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| | Skill | Description | | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -90,6 +90,19 @@ lark-cli auth login --recommend | |
| lark-cli calendar +agenda | ||
| ``` | ||
|
|
||
| #### 可选:Shell Completion | ||
|
|
||
| `lark-cli completion` 是一个普通的顶层命令,不需要先登录。可以为常用 shell 生成补全脚本: | ||
|
|
||
| ```bash | ||
| # Bash | ||
| lark-cli completion bash > ~/.local/share/bash-completion/completions/lark-cli | ||
|
|
||
| # Zsh | ||
| mkdir -p ~/.zfunc | ||
| lark-cli completion zsh > ~/.zfunc/_lark-cli | ||
| ``` | ||
|
Comment on lines
+101
to
+104
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Zsh completion setup is incomplete. The Zsh instructions create the file but don't mention adding fpath=(~/.zfunc $fpath)
autoload -Uz compinit && compinitConsider adding this note or linking to the Zsh completion documentation. 🤖 Prompt for AI Agents |
||
|
|
||
| ### 快速开始(AI Agent) | ||
|
|
||
| > 以下步骤面向 AI Agent,部分步骤需要用户在浏览器中配合完成。 | ||
|
|
@@ -126,6 +139,12 @@ lark-cli auth login --recommend | |
| lark-cli auth status | ||
| ``` | ||
|
|
||
| Shell completion 也不依赖认证: | ||
|
|
||
| ```bash | ||
| lark-cli completion fish > ~/.config/fish/completions/lark-cli.fish | ||
| ``` | ||
|
|
||
|
|
||
| ## Agent Skills | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // Copyright (c) 2026 Lark Technologies Pte. Ltd. | ||
| // SPDX-License-Identifier: MIT | ||
|
|
||
| package completion | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/larksuite/cli/internal/cmdutil" | ||
| ) | ||
|
|
||
| func TestNewCmdCompletion_IsVisibleAndAuthFree(t *testing.T) { | ||
| f, _, _, _ := cmdutil.TestFactory(t, nil) | ||
|
|
||
| cmd := NewCmdCompletion(f) | ||
| if cmd.Hidden { | ||
| t.Fatal("expected completion command to be visible") | ||
| } | ||
| if !cmdutil.IsAuthCheckDisabled(cmd) { | ||
| t.Fatal("expected completion command to skip auth checks") | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Zsh completion setup is incomplete (same issue as Chinese README).
Missing
fpathconfiguration. Users need to add the function path to.zshrc:🤖 Prompt for AI Agents