From d0221f409c4ad5d6eb7482394301f4688309189f Mon Sep 17 00:00:00 2001 From: Abin Simon Date: Sun, 11 Aug 2024 13:00:51 +0530 Subject: [PATCH] [scripts] ayo: only ask for content in case of command --- scripts/.local/bin/random/ayo | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/scripts/.local/bin/random/ayo b/scripts/.local/bin/random/ayo index 32349bde..1b79bf5c 100755 --- a/scripts/.local/bin/random/ayo +++ b/scripts/.local/bin/random/ayo @@ -4,17 +4,17 @@ set -e chatgpt --clear-history >/dev/null -# get the input text from stdin else ask for input -if [ -p /dev/stdin ]; then - input=$(cat) -else - printf "Content: " >&2 - read -r input -fi - if [ -n "$2" ]; then chatgpt "$*" else + # get the input text from stdin else ask for input + if [ -p /dev/stdin ]; then + input=$(cat) + else + printf "Content: " >&2 + read -r input + fi + echo "$input" | case "$1" in "professional") @@ -26,5 +26,17 @@ else "email") chatgpt "Make this into a casual business email." ;; + "summarize") + chatgpt "Can you summarize this message?" + ;; + "summary") + chatgpt "Can you summarize this message?" + ;; + "keypoints") + chatgpt "List the key points of this message." + ;; + *) + chatgpt "$1" + ;; esac fi