You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
471 B
Bash

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

#!/usr/bin/env bash
_have() { type "$1" &>/dev/null; }
declare OPENAI_API_KEY
OPENAI_API_KEY="$(head -1 "$HOME/.config/gpt/token")"
export OPENAI_API_KEY
! _have mods && echo "requires charmbracelet/mods" && exit 1
if test -t 0; then
if _have glow; then
mods --status-text "Ummm" -f "$*" | glow
else
mods --status-text "Ummm" "$*"
fi
else
mods --quiet "$*" | sed 's,[?25l [?25h[?1002l[?1003l,,g'
# |sed 's/\x1B\[[0-9;\?]*[a-zA-Z]//g'
fi