Skip to content

Commit 8ccb924

Browse files
committed
Add copilot integration
1 parent b433522 commit 8ccb924

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

setup_copilot.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/zsh
2+
3+
if ! [ -x "$(command -v brew)" ]; then
4+
if ! [ -z "$YES" ] || read -q "choice?Homebrew not installed or not on path. Install? (Press Y/y): "; then
5+
echo "Installing Homebrew"
6+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
7+
8+
if ! [ -x "$(command -v brew)" ]; then
9+
echo "Homebrew not on path. Using a default."
10+
if [[ "$(arch)" == "arm64" ]]; then
11+
BREW="/opt/homebrew/bin/brew"
12+
else
13+
BREW="/usr/local/bin/brew"
14+
fi
15+
else
16+
BREW="brew"
17+
fi
18+
19+
else
20+
exit 1
21+
fi
22+
else
23+
BREW="brew"
24+
fi
25+
26+
"$BREW" install gh
27+
28+
gh auth login
29+
gh extension install github/gh-copilot
30+
31+
echo "Example command explanation"
32+
gh copilot explain "brew install bazel"

zshrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,6 @@ function colorwheel() {
136136
POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true
137137

138138
[ -f /opt/homebrew/etc/profile.d/autojump.sh ] && . /opt/homebrew/etc/profile.d/autojump.sh
139+
if type "gh" > /dev/null; then
140+
eval "$(gh copilot alias -- zsh)"
141+
fi

0 commit comments

Comments
 (0)