-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Most widely used cli allow to generate completions via a top level command.
It would be so cool to have this, so we get this while the cursor is **:
bdg cdp Page**.navigate
navigate | navigateToHistoryEntry
The flow is simple. Wen can use gh completion <shell> to see a complete implementation.
❯ gh completion -h
Generate shell completion scripts for GitHub CLI commands.
When installing GitHub CLI through a package manager, it's possible that
no additional shell configuration is necessary to gain completion support. For
Homebrew, see <https://docs.brew.sh/Shell-Completion>
If you need to set up completions manually, follow the instructions below. The exact
config file locations might vary based on your system. Make sure to restart your
shell before testing whether completions are working.
### bash
First, ensure that you install `bash-completion` using your package manager.
After, add this to your `~/.bash_profile`:
eval "$(gh completion -s bash)"
### zsh
Generate a `_gh` completion script and put it somewhere in your `$fpath`:
gh completion -s zsh > /usr/local/share/zsh/site-functions/_gh
Ensure that the following is present in your `~/.zshrc`:
autoload -U compinit
compinit -i
Zsh version 5.7 or later is recommended.
### fish
Generate a `gh.fish` completion script:
gh completion -s fish > ~/.config/fish/completions/gh.fish
### PowerShell
Open your profile script with:
mkdir -Path (Split-Path -Parent $profile) -ErrorActionSilentlyContinue
notepad $profile
Add the line and save the file:
Invoke-Expression -Command $(gh completion -s powershell | Out-String)
USAGE
gh completion -s <shell>
FLAGS
-s, --shell string Shell type: {bash|zsh|fish|powershell}
INHERITED FLAGS
--help Show help for command
LEARN MORE
Use `gh <command> <subcommand> --help` for more information about a command.
Read the manual at https://cli.github.com/manual
Learn about exit codes using `gh help exit-codes`
Learn about accessibility experiences using `gh help accessibility`Metadata
Metadata
Assignees
Labels
No labels