|
37 | 37 | chmod +x /usr/local/bin/chatgpt
|
38 | 38 | echo "Installed chatgpt script to /usr/local/bin/chatgpt"
|
39 | 39 |
|
40 |
| -read -p "Please enter your OpenAI API key: " key |
| 40 | +echo "The script will add the OPENAI_KEY environment variable to your shell profile and add /usr/local/bin to your PATH" |
| 41 | +echo "Would you like to continue? (Yes/No)" |
| 42 | +read -e answer |
| 43 | +if [ "$answer" == "Yes" ] || [ "$answer" == "yes" ] || [ "$answer" == "y" ] || [ "$answer" == "Y" ] || [ "$answer" == "ok" ]; then |
| 44 | + |
| 45 | + read -p "Please enter your OpenAI API key: " key |
| 46 | + |
| 47 | + # Adding OpenAI key to shell profile |
| 48 | + # zsh profile |
| 49 | + if [ -f ~/.zprofile ]; then |
| 50 | + echo "export OPENAI_KEY=$key" >>~/.zprofile |
| 51 | + echo 'export PATH=$PATH:/usr/local/bin' >>~/.zprofile |
| 52 | + echo "OpenAI key and chatgpt path added to ~/.zprofile" |
| 53 | + source ~/.zprofile |
| 54 | + # bash profile mac |
| 55 | + elif [ -f ~/.bash_profile ]; then |
| 56 | + echo "export OPENAI_KEY=$key" >>~/.bash_profile |
| 57 | + echo 'export PATH=$PATH:/usr/local/bin' >>~/.bash_profile |
| 58 | + echo "OpenAI key and chatgpt path added to ~/.bash_profile" |
| 59 | + source ~/.bash_profile |
| 60 | + # profile ubuntu |
| 61 | + elif [ -f ~/.profile ]; then |
| 62 | + echo "export OPENAI_KEY=$key" >>~/.profile |
| 63 | + echo 'export PATH=$PATH:/usr/local/bin' >>~/.profile |
| 64 | + echo "OpenAI key and chatgpt path added to ~/.profile" |
| 65 | + source ~/.profile |
| 66 | + else |
| 67 | + export OPENAI_KEY=$key |
| 68 | + echo "You need to add this to your shell profile: export OPENAI_KEY=$key" |
| 69 | + fi |
| 70 | + echo "Installation complete" |
41 | 71 |
|
42 |
| -# Adding OpenAI key to shell profile |
43 |
| -# zsh profile |
44 |
| -if [ -f ~/.zprofile ]; then |
45 |
| - echo "export OPENAI_KEY=$key" >>~/.zprofile |
46 |
| - echo 'export PATH=$PATH:/usr/local/bin' >>~/.zprofile |
47 |
| - echo "OpenAI key and chatgpt path added to ~/.zprofile" |
48 |
| - source ~/.zprofile |
49 |
| -# bash profile mac |
50 |
| -elif [ -f ~/.bash_profile ]; then |
51 |
| - echo "export OPENAI_KEY=$key" >>~/.bash_profile |
52 |
| - echo 'export PATH=$PATH:/usr/local/bin' >>~/.bash_profile |
53 |
| - echo "OpenAI key and chatgpt path added to ~/.bash_profile" |
54 |
| - source ~/.bash_profile |
55 |
| -# profile ubuntu |
56 |
| -elif [ -f ~/.profile ]; then |
57 |
| - echo "export OPENAI_KEY=$key" >>~/.profile |
58 |
| - echo 'export PATH=$PATH:/usr/local/bin' >>~/.profile |
59 |
| - echo "OpenAI key and chatgpt path added to ~/.profile" |
60 |
| - source ~/.profile |
61 | 72 | else
|
62 |
| - export OPENAI_KEY=$key |
63 |
| - echo "You need to add this to your shell profile: export OPENAI_KEY=$key" |
| 73 | + echo "Please take a look at the instructions to install manually: https://github.com/0xacx/chatGPT-shell-cli/tree/main#manual-installation " |
| 74 | + exit |
64 | 75 | fi
|
65 |
| -echo "Installation complete" |
|
0 commit comments