-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgithub-copilot-cli.zsh
More file actions
30 lines (26 loc) · 984 Bytes
/
Copy pathgithub-copilot-cli.zsh
File metadata and controls
30 lines (26 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# GitHub Copilot CLI (https://github.com/github/gh-copilot)
# Check if the gh copilot extension is installed and load aliases accordingly
# TODO: potentially refactor/improve this to work with the new gh copilot extension better
# see https://github.com/github/gh-copilot/issues/5
if gh extension list | grep -q 'github/gh-copilot'; then
echo "Loading gh copilot extension aliases.. (ghce, ghcs, ??, git?, gh?)"
eval "$(gh copilot alias -- zsh)"
# Function to handle general shell command suggestions
copilot_shell_suggest() {
# gh copilot suggest -t shell "$@"
ghcs "$@"
}
alias '??'='copilot_shell_suggest'
# Function to handle Git command suggestions
copilot_git_suggest() {
# gh copilot suggest -t git "$@"
ghcs -t git "$@"
}
alias 'git?'='copilot_git_suggest'
# Function to handle GitHub CLI command suggestions
copilot_gh_suggest() {
# gh copilot suggest -t gh "$@"
ghcs -t gh "$@"
}
alias 'gh?'='copilot_gh_suggest'
fi