-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_butterfish.sh
executable file
·41 lines (35 loc) · 1.39 KB
/
install_butterfish.sh
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
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
# Install Butterfish
# Author: Peter Bakkum
if ! type update-system &> /dev/null; then
if ! test -f aliases/.bash_aliases.d/update-system.sh; then
eval "$(curl -fsSL https://raw.githubusercontent.com/excited-bore/dotfiles/main/aliases/.bash_aliases.d/update-system.sh)"
else
. ./aliases/.bash_aliases.d/update-system.sh
fi
fi
if test -z $SYSTEM_UPDATED; then
readyn -Y "CYAN" -p "Update system?" updatesysm
if test $updatesysm == "y"; then
update-system
fi
fi
if ! type go &> /dev/null; then
echo "Go is not installed. Installing Go..."
if ! test -f install_go.sh; then
eval "$(curl -fsSL https://raw.githubusercontent.com/excited-bore/dotfiles/main/aliases/.bash_aliases.d/00-rlwrap_scripts.sh)"
else
. ./aliases/.bash_aliases.d/00-rlwrap_scripts.sh
fi
fi
go install github.com/bakks/butterfish/cmd/butterfish@latest
echo "Go to https://platform.openai.com/account/api-keys to get your OpenAI API key."
echo "Then put it in ~/.config/butterfish/buttefish.env, like so:"
echo "OPENAI_TOKEN=sk-foobar"
readyn -p "Edit ~/.config/buttefish/buttefish.env now?" response
if [ "$response" == "y" ]; then
mkdir -p ~/.config/butterfish
touch ~/.config/butterfish/butterfish.env
printf "OPENAI_TOKEN=" > ~/.config/butterfish/butterfish.env
$EDITOR ~/.config/butterfish/butterfish.env
fi