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 ⟨https://docs.brew.sh/Shell-Completion⟩
23
24
25 If you need to set up completions manually, follow the instructions be‐
26 low. The exact config file locations might vary based on your system.
27 Make sure to restart your shell before testing whether completions are
28 working.
29
30
31 bash
32 First, ensure that you install bash-completion using your package man‐
33 ager.
34
35
36 After, add this to your ~/.bash_profile:
37
38
39 eval "$(gh completion -s bash)"
40
41
42
43 zsh
44 Generate a _gh completion script and put it somewhere in your $fpath:
45
46
47 gh completion -s zsh > /usr/local/share/zsh/site-functions/_gh
48
49
50
51 Ensure that the following is present in your ~/.zshrc:
52
53
54 autoload -U compinit
55 compinit -i
56
57
58
59 Zsh version 5.7 or later is recommended.
60
61
62 fish
63 Generate a gh.fish completion script:
64
65
66 gh completion -s fish > ~/.config/fish/completions/gh.fish
67
68
69
70 PowerShell
71 Open your profile script with:
72
73
74 mkdir -Path (Split-Path -Parent $profile) -ErrorAction SilentlyContinue
75 notepad $profile
76
77
78
79 Add the line and save the file:
80
81
82 Invoke-Expression -Command $(gh completion -s powershell | Out-String)
83
84
85
86
88 -s, --shell <string>
89 Shell type: {bash|zsh|fish|powershell}
90
91
92
94 gh(1)
95
96
97
98 Oct 2023 GH-COMPLETION(1)