Skip to content

UI helpers

๐Ÿ“ฆ ui package

These helpers provide methods to help you to create a better CLI interface for interacting with the LLMs.

Input

func Input(color, prompt string) (string, error)

Input displays a prompt with the specified color and waits for user input.

Parameters: - color: A string representing the color of the prompt text. - prompt: A string representing the prompt message to display.

Returns: - A string containing the user input, trimmed of any leading or trailing whitespace. - An error if there was an issue running the input program or if the input could not be retrieved.

res, err := ui.Input(colors.Cyan, "๐Ÿค– ask me something>")

Println

Println(color string, strs ...interface{})

Println prints the provided strings with the specified color using the lipgloss styling library. The color parameter should be a string representing the desired color. The strs parameter is a variadic argument that accepts multiple values to be printed.

Parameters: - color: A string representing the color to be used for the text. - strs: A variadic parameter that accepts multiple values to be printed.

ui.Println(colors.Magenta, "๐Ÿ‘‹ hello ๐Ÿค–")

Imports:

"github.com/parakeet-nest/parakeet/ui"
"github.com/parakeet-nest/parakeet/ui/colors"

Info

I used these two great libraries to create the helpers: - github.com/charmbracelet/bubbletea - github.com/charmbracelet/lipgloss

Note

๐Ÿ‘€ you will find complete examples in: