[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[[["\u003cp\u003eThe gdcloud CLI autocomplete feature allows users to complete commands by pressing the \u003ckbd\u003eTab\u003c/kbd\u003e key, providing suggestions as they type.\u003c/p\u003e\n"],["\u003cp\u003eThis autocompletion feature is compatible with Bash, Zsh, and Fish shells on Linux operating systems, and instructions are provided for all three.\u003c/p\u003e\n"],["\u003cp\u003eUsers can load completions temporarily for the current shell session or permanently for all future sessions, with specific commands provided for each shell type.\u003c/p\u003e\n"],["\u003cp\u003eTo use the autocomplete, users simply type part of a command and press \u003ckbd\u003eTab\u003c/kbd\u003e; pressing it twice will display a list of all possible commands if there are more than one.\u003c/p\u003e\n"],["\u003cp\u003eBefore enabling autocompletion for Zsh, you must verify that shell completion is enabled and if not there are commands provided to enable the feature.\u003c/p\u003e\n"]]],[],null,["# gdcloud CLI autocomplete\n\nThis page provides instructions for configuring and using the gdcloud CLI autocomplete feature that enables you to use the \u003ckbd\u003eTab\u003c/kbd\u003e key to complete a partially entered command. This feature is available for Bash, Zsh, and Fish shells.\nThe gdcloud CLI autocompletion is a feature that provides suggestions for commands and options as you type. This can be helpful when you are not sure what command to use or when you want to use a command that you have not used before.\n\nActivate autocompletion\n-----------------------\n\nTo activate the auto--completion feature you will need to run a command for your terminal. The gdcloud CLI autocompletion feature is available for the Linux operating system in the Bash, Zsh, and Fish shells. Use the following command to figure out which shell you use. \n\n echo $SHELL\n\nThe output looks like `bin/$SHELL` where `$SHELL` is either bash, zsh, or fish.\n\n### Bash\n\nTo load completions in your current shell session: \n\n source \u003c(gdcloud completion bash)\n\nTo load completions for every new session, execute once: \n\n gdcloud completion bash \u003e /etc/bash_completion.d/gdcloud\n\n### Zsh\n\nIf shell completion is not already enabled in your environment, you must enable it. Check whether shell completion is enabled.\n\nCheck the value of the `COMP_LINE` variable. If the value of the `COMP_LINE` variable is empty, then shell completion is not enabled. You can check this value by running the following command: \n\n echo $COMP_LINE\n\nTry to use shell completion with a command. If you try to use shell completion with a command and it does not work, the shell completion is not enabled. For example, try typing the following command and pressing \u003ckbd\u003eTab\u003c/kbd\u003e. If shell completion is enabled, you must see a list of possible completions for the `ls` command. \n\n ls\n\nCheck the output of the compgen -c command. If the output of the `compgen -c` command contains no commands, then shell completion is not enabled. You can run the following command to see the output of the `compgen -c` command. If shell completion is enabled, the output of the command should include a list of commands that have completion functions. \n\n compgen -c\n\nIf you are not sure if shell completion is enabled in your environment, check documentation for your shell.\nIf shell completion is not enabled in your environment, execute the following command to enable it: \n\n echo \"autoload -U compinit; compinit\" \u003e\u003e ~/.zshrc\n\nTo load completions in your current shell session: \n\n source \u003c(gdcloud completion zsh); compdef _gdcloud gdcloud\n\nTo load completions for each session, execute once: \n\n gdcloud completion zsh \u003e \"${fpath[1]}/_gdcloud\"\n\nYou must start a new shell for this setup to take effect.\n\n### Fish\n\nTo load completions in your current shell session: \n\n gdcloud completion fish | source\n\nTo load completions for each session, run: \n\n gdcloud completion fish \u003e ~/.config/fish/completions/gdcloud.fish\n\nYou must start a new shell for this setup to take effect.\n\nUse autocompletion\n------------------\n\nTo use gdcloud CLI autocompletion, type the first few characters of the command that you want to use and then press the \u003ckbd\u003eTab\u003c/kbd\u003e key. If there is only one possible completion, it is automatically inserted into the command line. If the command does not autofill, then that means there are multiple possible completions and you must press the \u003ckbd\u003eTab\u003c/kbd\u003e key again to view all the possible commands.\n\n### Autocomplete examples\n\nType a command partially and then press \u003ckbd\u003eTab\u003c/kbd\u003e to autocomplete the command: \n\n gdcloud con \u003cTAB\u003e\n\nComplete command after pressing \u003ckbd\u003eTab\u003c/kbd\u003e once: \n\n gdcloud config\n\nType a command partially and then press \u003ckbd\u003eTab\u003c/kbd\u003e twice to see a list of all possible commands: \n\n gdcloud clusters \u003cTAB\u003e \u003cTAB\u003e\n describe get-credentials list\n gdcloud clusters"]]