1GH-COMPLETION(1) GitHub CLI manual GH-COMPLETION(1)
2
3
4
6 gh-completion - Generate shell completion scripts
7
8
9
11 gh completion -s <shell>
12
13
14
16 Generate shell completion scripts for GitHub CLI commands.
17
18
19 When installing GitHub CLI through a package manager, it's possible
20 that no additional shell configuration is necessary to gain completion
21 support. For Homebrew, see ⟨https://docs.brew.sh/Shell-Completion⟩
22
23
24 If you need to set up completions manually, follow the instructions be‐
25 low. The exact config file locations might vary based on your system.
26 Make sure to restart your shell before testing whether completions are
27 working.
28
29
30 bash
31 First, ensure that you install bash-completion using your package man‐
32 ager.
33
34
35 After, add this to your ~/.bash_profile:
36
37 eval "$(gh completion -s bash)"
38
39
40
41 zsh
42 Generate a _gh completion script and put it somewhere in your $fpath:
43
44 gh completion -s zsh > /usr/local/share/zsh/site-functions/_gh
45
46
47
48 Ensure that the following is present in your ~/.zshrc:
49
50 autoload -U compinit
51 compinit -i
52
53
54
55 Zsh version 5.7 or later is recommended.
56
57
58 fish
59 Generate a gh.fish completion script:
60
61 gh completion -s fish > ~/.config/fish/completions/gh.fish
62
63
64
65 PowerShell
66 Open your profile script with:
67
68 mkdir -Path (Split-Path -Parent $profile) -ErrorAction SilentlyContinue
69 notepad $profile
70
71
72
73 Add the line and save the file:
74
75 Invoke-Expression -Command $(gh completion -s powershell | Out-String)
76
77
78
79
81 -s, --shell <string>
82 Shell type: {bash|zsh|fish|powershell}
83
84
85
87 gh(1)
88
89
90
91 Nov 2023 GH-COMPLETION(1)