LinuxCommandLibrary

gh-completion

generate shell completion scripts

TLDR

Generate bash completions

$ gh completion -s bash > ~/.local/share/bash-completion/completions/gh
copy
Generate zsh completions
$ gh completion -s zsh > "${fpath[1]}/_gh"
copy
Generate fish completions
$ gh completion -s fish > ~/.config/fish/completions/gh.fish
copy
Generate PowerShell completions
$ gh completion -s powershell >> $PROFILE
copy

SYNOPSIS

gh completion -s shell

DESCRIPTION

gh completion generates shell completion scripts for the GitHub CLI. These scripts enable tab completion for gh commands, subcommands, flags, and dynamic values like repository names and branches.
The completions integrate with each shell's native completion system, providing context-aware suggestions. Dynamic completions query GitHub for repositories, issues, and pull requests.
Completion scripts should be regenerated after gh updates to include new commands.

PARAMETERS

-s SHELL, --shell SHELL

Shell type: bash, zsh, fish, powershell.
--help
Display help information.

CAVEATS

Output must be saved to appropriate shell completion directory. Shell may need restart or sourcing to load completions. Dynamic completions require authentication.

HISTORY

gh completion is built into the GitHub CLI, following Unix conventions for providing shell integration via completion scripts.

SEE ALSO

gh(1), bash(1), zsh(1), fish(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community