mirror of
https://github.com/0xacx/chatGPT-shell-cli.git
synced 2024-11-24 11:25:31 +00:00
Add explanatory comments for run modes
This commit is contained in:
parent
d79cf405ad
commit
2d29a805e4
10
chatgpt.sh
10
chatgpt.sh
@ -215,15 +215,15 @@ if [ ! -f ~/.chatgpt_history ]; then
|
||||
fi
|
||||
|
||||
running=true
|
||||
# check input source
|
||||
# prompt from argument
|
||||
# check input source and determine run mode
|
||||
|
||||
# prompt from argument, run on pipe mode (run once, no chat)
|
||||
if [ -n "$prompt" ]; then
|
||||
pipe_mode_prompt=${prompt}
|
||||
# if input file_descriptor is a terminal
|
||||
# if input file_descriptor is a terminal, run on chat mode
|
||||
elif [ -t 0 ]; then
|
||||
echo -e "Welcome to chatgpt. You can quit with '\033[36mexit\033[0m'."
|
||||
# if prompt already entered, run on pipe mode (run once, no chat)
|
||||
# prompt from pipe
|
||||
# prompt from pipe or redirected stdin, run on pipe mode
|
||||
else
|
||||
pipe_mode_prompt+=$(cat -)
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user