Skip to content

fix installation error #167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,21 @@ echo "Installed chatgpt script to /usr/local/bin/chatgpt"

echo "The script will add the OPENAI_KEY environment variable to your shell profile and add /usr/local/bin to your PATH"
echo "Would you like to continue? (Yes/No)"
read -e answer
# Ensure reading from the terminal even if script is piped
if [ -t 0 ]; then
read -r answer
else
read -r answer < /dev/tty
fi

if [ "$answer" == "Yes" ] || [ "$answer" == "yes" ] || [ "$answer" == "y" ] || [ "$answer" == "Y" ] || [ "$answer" == "ok" ]; then

read -p "Please enter your OpenAI API key: " key
echo "Please enter your OpenAI API key: "
if [ -t 0 ]; then
read -r key
else
read -r key < /dev/tty
fi

# Adding OpenAI key to shell profile
# zsh profile
Expand Down