Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default value for $columns using tput cols #162

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions chatgpt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,9 @@ while [[ "$#" -gt 0 ]]; do
exit 0
;;
*)
echo "Unknown parameter: $1"
exit 1
# default mode: use the first parameter as the prompt. Eg: chatgpt "question ?"
prompt=$1
shift
;;
esac
done
Expand All @@ -290,6 +291,10 @@ SIZE=${SIZE:-512x512}
CONTEXT=${CONTEXT:-false}
MULTI_LINE_PROMPT=${MULTI_LINE_PROMPT:-false}

if [ -z "${COLUMNS}" ]; then
COLUMNS=$(tput cols)
fi

# create our temp file for multi-line input
if [ $MULTI_LINE_PROMPT = true ]; then
USER_INPUT_TEMP_FILE=$(mktemp)
Expand Down