Skip to content

Commit 2d29a80

Browse files
committed
Add explanatory comments for run modes
1 parent d79cf40 commit 2d29a80

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

chatgpt.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,15 +215,15 @@ if [ ! -f ~/.chatgpt_history ]; then
215215
fi
216216

217217
running=true
218-
# check input source
219-
# prompt from argument
218+
# check input source and determine run mode
219+
220+
# prompt from argument, run on pipe mode (run once, no chat)
220221
if [ -n "$prompt" ]; then
221222
pipe_mode_prompt=${prompt}
222-
# if input file_descriptor is a terminal
223+
# if input file_descriptor is a terminal, run on chat mode
223224
elif [ -t 0 ]; then
224225
echo -e "Welcome to chatgpt. You can quit with '\033[36mexit\033[0m'."
225-
# if prompt already entered, run on pipe mode (run once, no chat)
226-
# prompt from pipe
226+
# prompt from pipe or redirected stdin, run on pipe mode
227227
else
228228
pipe_mode_prompt+=$(cat -)
229229
fi

0 commit comments

Comments
 (0)