> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/zenlayer-cli/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/zenlayer-cli/configure/completion.md).

# Command Completion

Zenlayer Cloud CLI includes a command completion feature that enables you to use the Tab key to complete partially entered commands. On most systems, you need to manually configure this feature.

## How It Works

When you partially enter a command, parameter, or option, the command completion feature automatically completes your command or displays a list of suggested commands. To trigger command completion, partially enter a command and press the completion key, which is usually the Tab key in most shells.

The following examples demonstrate different ways to use command completion:

### Example 1: Completing Commands

```bash
# Partially enter a command and press Tab to display suggested commands
$ zeno z<Tab>
zec  -- Manage ZEC resources
```

### Example 2: Completing Parameters

```bash
# Partially enter a parameter and press Tab to display suggested parameters

$ zeno zec describe-instances --<Tab>
--access-key-id       -- access key ID (overrides config)
--access-key-id      -- access key ID (overrides config)
--access-key-secret  -- access key secret (overrides config)
--debug              -- enable debug mode
--endpoint           -- API domain/endpoint (overrides default)
--help               -- help for this command
--image-id           -- Image ID.
--instance-ids       -- Instance IDs.
--ipv4-address       -- IPv4 addresses.
--ipv6-address       -- IPv6 addresses.
--name               -- Instance name.
--output             -- output format: json, table (default: from config)
--page-num           -- Number of pages returned.
--page-size          -- Number of items in the current page result.
--profile            -- profile name to use (default: from config)
--query              -- JMESPath query to filter response (e.g. dataSet[*].instanceId)
--resource-group-id  -- Resource Group ID.
--status             -- Instance status. (DEPLOYING|REBUILDING|REBOOT|RUNNING|STOPPED|BOOTING|RELEASING|STOPPING|RECYCLE|RECYCLING|CREATE_FAILED|IMAGING|RESIZING)
--tag-keys           -- Query using tag keys.
--tags               -- Query using tags.
--zone-id            -- Zone ID to which the instances belong.
```

## Configuring Command Completion on Linux or macOS

To configure command completion on Linux or macOS, you need to know the name of the shell you are using and the location of the zeno completion script.

### Step 1: Enable Command Completion

#### Bash

**Linux**:

```bash
# Install auto-completion
zeno completion bash > /etc/bash_completion.d/zeno

# Reload bash configuration
source ~/.bashrc
```

**macOS**:

On macOS, you need to first install `bash-completion`:

```bash
# Install bash-completion
brew install bash-completion

# Install auto-completion
zeno completion bash > $(brew --prefix)/etc/bash_completion.d/zeno

# Reload bash configuration
source ~/.bash_profile
```

#### Zsh

**Option 1: Using the default fpath**

```bash
# Install auto-completion
zeno completion zsh > "${fpath[1]}/_zeno"

# Reload zsh configuration
source ~/.zshrc
```

**Option 2: Using a custom completion directory**

```bash
# Create a custom completion directory
mkdir -p ~/.zsh/completions

# Install auto-completion
zeno completion zsh > ~/.zsh/completions/_zeno

# Add to fpath
echo 'fpath=(~/.zsh/completions $fpath)' >> ~/.zshrc
echo 'autoload -U compinit; compinit' >> ~/.zshrc

# Reload zsh configuration
source ~/.zshrc
```

#### Fish

```bash
# Install auto-completion
zeno completion fish > ~/.config/fish/completions/zeno.fish

# Reload fish configuration
# No additional steps needed, fish automatically loads new completion scripts
```

## Configuring Command Completion on Windows

### PowerShell

```powershell
# Install auto-completion
zeno completion powershell | Out-String | Invoke-Expression

# Persist auto-completion
zeno completion powershell >> $PROFILE
```

## Verifying Command Completion

To verify that command completion is working properly, open a new terminal session and try the following:

1. Type `zeno` and press Tab, which should display a list of available commands
2. Type `zeno zec describe-` and press Tab, which should display commands starting with "describe-"
3. Type `zeno zec describe-instances --` and press Tab, which should display a list of available parameters

## Uninstalling Command Completion

To uninstall command completion, use the `--uninstall` option:

```bash
# Uninstall auto-completion for all shells
zeno completion --uninstall

# Uninstall auto-completion for a specific shell
zeno completion --uninstall bash  # Uninstall Bash auto-completion
zeno completion --uninstall zsh    # Uninstall Zsh auto-completion
zeno completion --uninstall fish   # Uninstall Fish auto-completion
zeno completion --uninstall powershell  # Uninstall PowerShell auto-completion
```

## Important Notes

* **Shell Restart**: After configuring command completion, you may need to restart your shell for changes to take effect
* **Permissions**: On some systems, administrator privileges may be required to install auto-completion scripts
* **Compatibility**: Command completion may have minor differences across different shells and operating systems
* **Version**: Ensure you are using the latest version of Zenlayer Cloud CLI for the best command completion experience


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.console.zenlayer.com/zenlayer-cli/configure/completion.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
