From b06033f2caccc4afced060545e7873058fc88ba3 Mon Sep 17 00:00:00 2001 From: Yingdi Shan <5491399+yingdi-shan@users.noreply.github.com> Date: Sun, 9 Aug 2026 00:56:17 +0000 Subject: [PATCH] fix(cli): hide internal completion command --- crates/aenv/src/main.rs | 1 + docs/src/getting-started/aenv-cli.md | 65 ---------------------------- 2 files changed, 1 insertion(+), 65 deletions(-) diff --git a/crates/aenv/src/main.rs b/crates/aenv/src/main.rs index beb382186..812f353ca 100644 --- a/crates/aenv/src/main.rs +++ b/crates/aenv/src/main.rs @@ -34,6 +34,7 @@ enum Cmd { /// Download a file from a sandbox Download(commands::download::Args), /// Generate shell completion scripts + #[command(hide = true)] Completion(commands::completion::Args), /// Attach an interactive shell to a running sandbox #[command(visible_alias = "cn")] diff --git a/docs/src/getting-started/aenv-cli.md b/docs/src/getting-started/aenv-cli.md index 49eab61d1..53104f5b4 100644 --- a/docs/src/getting-started/aenv-cli.md +++ b/docs/src/getting-started/aenv-cli.md @@ -274,68 +274,3 @@ aenv snapshot list --sandbox-id The table output includes an `IMAGE REF` column (`-` when no image was published); JSON output includes the optional `imageRef` field. To delete a snapshot, use `aenv template delete ` or `aenv template delete ` — snapshots share the same underlying store as templates and are deleted through the same command. - ---- - -## Shell completion - -`aenv completion ` prints a shell-completion script for the `aenv` CLI to stdout. - -### Generate and install a script - -#### Bash - -```bash -mkdir -p ~/.local/share/bash-completion/completions -aenv completion bash > ~/.local/share/bash-completion/completions/aenv -``` - -The Bash completion file is loaded on demand by -[`bash-completion`](https://github.com/scop/bash-completion). -This requires `bash-completion` to be installed and initialized in the current -shell. - -#### Zsh - -```zsh -mkdir -p ~/.local/share/zsh/site-functions -aenv completion zsh > ~/.local/share/zsh/site-functions/_aenv -``` - -Zsh loads completion functions from directories listed in `fpath`. -`~/.local/share/zsh/site-functions` is not included in `fpath` by default on -all systems. Add the following lines to `~/.zshrc` before any existing -`compinit` invocation: - -```zsh -fpath=(~/.local/share/zsh/site-functions $fpath) -autoload -Uz compinit -compinit -``` - -#### Fish - -```shell -mkdir -p ~/.config/fish/completions -aenv completion fish > ~/.config/fish/completions/aenv.fish -``` - -### Activate without installing - -To test completion for the current shell session without saving a generated -file: - -```bash -source <(aenv completion bash) # Bash -eval "$(aenv completion zsh)" # Zsh -aenv completion fish | source # Fish -``` - -Once loaded, completion covers the CLI surface: - -```bash -aenv # top-level commands -aenv snapshot # nested subcommands (create, list, ...) -aenv list --output # enum values: table, json -aenv build ./ # local path arguments -```