Documentation ¶
Index ¶
- func AttemptPrettyPrint(chatMessage models.Message, username string, raw bool) error
- func ClearTermTo(termWidth, upTo int)
- func CreateFile[T any](path string, toCreate *T) error
- func GetFirstTokens(prompt []string, n int) []string
- func LoadConfigFromFile[T any](placeConfigPath, configFileName string, migrationCb func(string) error, ...) (T, error)
- func Prompt(stdinReplace string, args []string) (string, error)
- func RandomPrefix() string
- func ReadAndUnmarshal[T any](filePath string, config *T) error
- func ReplaceTildeWithHome(s string) (string, error)
- func ReturnNonDefault[T comparable](a, b, defaultVal T) (T, error)
- func TermWidth() (int, error)
- func UpdateMessageTerminalMetadata(msg string, line *string, lineCount *int, termWidth int)
- func WriteFile[T any](path string, toWrite *T) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AttemptPrettyPrint ¶
AttemptPrettyPrint by first checking if the glow command is available, and if so, pretty print the chat message if not found, simply print the message as is
func ClearTermTo ¶
func ClearTermTo(termWidth, upTo int)
func CreateFile ¶
func GetFirstTokens ¶
GetFirstTokens returns the first n tokens of the prompt, or the whole prompt if it has less than n tokens
func LoadConfigFromFile ¶
func Prompt ¶
Prompt returns the prompt by checking all the arguments and stdin. If there is no arguments, but data in stdin, stdin will become the prompt. If there are arguments and data in stdin, all stdinReplace tokens will be substituted with the data in stdin
func RandomPrefix ¶
func RandomPrefix() string
func ReadAndUnmarshal ¶
ReadAndUnmarshal by first finding the file, then attempting to read + unmarshal to T
func ReplaceTildeWithHome ¶ added in v1.3.17
func ReturnNonDefault ¶
func ReturnNonDefault[T comparable](a, b, defaultVal T) (T, error)
func UpdateMessageTerminalMetadata ¶
UpdateMessageTerminalMetadata updates the terminal metadata. Meaning the lineCount, to eventually clear the terminal
Types ¶
This section is empty.