Forrest logo
back to the gh tool

gh-completion:tldr:6dcd2

gh-completion: Print a completion script.
$ gh completion --shell ${select}
try on your machine

The command "gh completion --shell ${select}" is used to generate shell completion scripts for the GitHub CLI (Command Line Interface) tool. The "--shell" flag specifies the type of shell for which the completion script is generated, and "${select}" is a placeholder for the desired shell type.

When you run this command, it will output the completion script for the specified shell type, which can then be added to your shell's configuration file to enable auto-completion for GitHub CLI commands.

For example, if you are using the Bash shell, you would run the command "gh completion --shell bash" to get the completion script for Bash. You can then add the output of the command to your "~/.bashrc" file to make the completion script persistent across terminal sessions.

Once the completion script is set up, you can type "gh" followed by a space and then use the Tab key to auto-complete commands, options, and arguments, making it easier and faster to interact with GitHub through the command line.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the gh tool