Skip to content

Commit d0221f4

Browse files
committed
[scripts] ayo: only ask for content in case of command
1 parent 78dda94 commit d0221f4

File tree

1 file changed

+20
-8
lines changed
  • scripts/.local/bin/random

1 file changed

+20
-8
lines changed

scripts/.local/bin/random/ayo

+20-8
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ set -e
44

55
chatgpt --clear-history >/dev/null
66

7-
# get the input text from stdin else ask for input
8-
if [ -p /dev/stdin ]; then
9-
input=$(cat)
10-
else
11-
printf "Content: " >&2
12-
read -r input
13-
fi
14-
157
if [ -n "$2" ]; then
168
chatgpt "$*"
179
else
10+
# get the input text from stdin else ask for input
11+
if [ -p /dev/stdin ]; then
12+
input=$(cat)
13+
else
14+
printf "Content: " >&2
15+
read -r input
16+
fi
17+
1818
echo "$input" |
1919
case "$1" in
2020
"professional")
@@ -26,5 +26,17 @@ else
2626
"email")
2727
chatgpt "Make this into a casual business email."
2828
;;
29+
"summarize")
30+
chatgpt "Can you summarize this message?"
31+
;;
32+
"summary")
33+
chatgpt "Can you summarize this message?"
34+
;;
35+
"keypoints")
36+
chatgpt "List the key points of this message."
37+
;;
38+
*)
39+
chatgpt "$1"
40+
;;
2941
esac
3042
fi

0 commit comments

Comments
 (0)