mirror of
https://github.com/0xacx/chatGPT-shell-cli.git
synced 2025-02-22 18:55:29 +00:00
Print installation info for troubleshooting, source profiles after install, VScode autoformatting
This commit is contained in:
parent
edf6b16f27
commit
0fb01e59c7
42
install.sh
42
install.sh
@ -1,23 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "This script must be run as root"
|
||||
exit 1
|
||||
echo "This script must be run as root"
|
||||
exit 1
|
||||
fi
|
||||
# Check dependencies
|
||||
if type curl &>/dev/null
|
||||
then
|
||||
echo "" &>/dev/null
|
||||
if type curl &>/dev/null; then
|
||||
echo "" &>/dev/null
|
||||
else
|
||||
echo "You need to install 'curl' to use the chatgpt script."
|
||||
exit
|
||||
echo "You need to install 'curl' to use the chatgpt script."
|
||||
exit
|
||||
fi
|
||||
if type jq &>/dev/null
|
||||
then
|
||||
echo "" &>/dev/null
|
||||
if type jq &>/dev/null; then
|
||||
echo "" &>/dev/null
|
||||
else
|
||||
echo "You need to install 'jq' to use the chatgpt script."
|
||||
exit
|
||||
echo "You need to install 'jq' to use the chatgpt script."
|
||||
exit
|
||||
fi
|
||||
|
||||
# Installing imgcat if using iTerm
|
||||
@ -25,34 +23,38 @@ if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
||||
if [[ ! $(which imgcat) ]]; then
|
||||
curl -sS https://iterm2.com/utilities/imgcat -o /usr/local/bin/imgcat
|
||||
chmod +x /usr/local/bin/imgcat
|
||||
echo "Installed imgcat"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Installing chatgpt script
|
||||
curl -sS https://raw.githubusercontent.com/0xacx/chatGPT-shell-cli/main/chatgpt.sh -o /usr/local/bin/chatgpt
|
||||
chmod +x /usr/local/bin/chatgpt
|
||||
echo "Installed chatgpt script to /usr/local/bin/chatgpt"
|
||||
|
||||
read -p "Please enter your OpenAI API key: " key
|
||||
|
||||
# Adding OpenAI key to shell profile
|
||||
# zsh profile
|
||||
if [ -f ~/.zprofile ]; then
|
||||
echo "export OPENAI_KEY=$key" >> ~/.zprofile
|
||||
echo 'export PATH=$PATH:/usr/local/bin' >> ~/.zprofile
|
||||
echo "export OPENAI_KEY=$key" >>~/.zprofile
|
||||
echo 'export PATH=$PATH:/usr/local/bin' >>~/.zprofile
|
||||
echo "OpenAI key and chatgpt path added to ~/.zprofile"
|
||||
source ~/.zprofile
|
||||
# bash profile mac
|
||||
elif [ -f ~/.bash_profile ]; then
|
||||
echo "export OPENAI_KEY=$key" >> ~/.bash_profile
|
||||
echo 'export PATH=$PATH:/usr/local/bin' >> ~/.bash_profile
|
||||
echo "export OPENAI_KEY=$key" >>~/.bash_profile
|
||||
echo 'export PATH=$PATH:/usr/local/bin' >>~/.bash_profile
|
||||
echo "OpenAI key and chatgpt path added to ~/.bash_profile"
|
||||
source ~/.bash_profile
|
||||
# profile ubuntu
|
||||
elif [ -f ~/.profile ]; then
|
||||
echo "export OPENAI_KEY=$key" >> ~/.profile
|
||||
echo 'export PATH=$PATH:/usr/local/bin' >> ~/.profile
|
||||
echo "export OPENAI_KEY=$key" >>~/.profile
|
||||
echo 'export PATH=$PATH:/usr/local/bin' >>~/.profile
|
||||
echo "OpenAI key and chatgpt path added to ~/.profile"
|
||||
source ~/.profile
|
||||
else
|
||||
export OPENAI_KEY=$key
|
||||
echo "You need to add this to your shell profile: export OPENAI_KEY=$key"
|
||||
fi
|
||||
echo "Installation complete."
|
||||
chatgpt
|
||||
echo "Installation complete"
|
||||
|
Loading…
Reference in New Issue
Block a user