Documentation
¶
Index ¶
- func BreakOutMap(m map[string]string) (keys []string, values []string)
- func Contains(slice []string, item string) bool
- func DedupeStringSlice(s []string) []string
- func EndsWithAny(s string, suffixes []string) bool
- func GetJSONKeys(j any) ([]string, error)
- func GlobAll(patterns []string) ([]string, error)
- func Input(prompt string) (string, error)
- func InputWithColor(prompt, cssColorCode string) (string, error)
- func InsertLine(code string, lineNumber int, newText string) (string, error)
- func InsertLinesAtIndices(file string, indices []int, linesToInsert []string) (string, error)
- func LoadFile(filePath string) (string, error)
- func PrintChatCompletionStream(stream *openai.ChatCompletionStream) (string, error)
- func PrintColoredText(text, cssColorCode string)
- func PrintColoredTextLn(text, cssColorCode string)
- func ReadStdin() ([]byte, error)
- func RemoveQuotes(s string) string
- func ReplaceLines(code string, startLine int, endLine int, newText string) (string, error)
- func ReverseSlice[T any](s []T)
- func StartsWithAny(s string, prefixes []string) bool
- func StringInSlice(s string, slice []string) bool
- func StringSliceToAnySlice(s []string) []any
- func WriteFile(filePath string, contents string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BreakOutMap ¶
BreakOutMap takes a map and returns two slices, one containing the keys and the other containing the values.
func DedupeStringSlice ¶
DedupeStringSlice removes duplicate strings from a slice of strings.
func EndsWithAny ¶ added in v0.0.3
EndsWithAny takes a string and a slice of suffixes and returns true if the string ends with any of the suffixes.
func GetJSONKeys ¶
GetJSONKeys returns the keys of a JSON object as a slice of strings.
func InputWithColor ¶
InputWithColor prompts the user for input and returns the entered text. The prompt is displayed in the specified CSS color code.
func InsertLine ¶ added in v0.0.3
InsertLine inserts a new line of text at the specified line number in the code.
func InsertLinesAtIndices ¶ added in v0.0.3
InsertLinesAtIndices inserts multiple lines of text at the specified line numbers in the code.
func LoadFile ¶ added in v0.0.2
LoadFile reads the contents of a file at the specified path and returns it as a string. An error is returned if the file cannot be read or if it is not valid UTF-8.
func PrintChatCompletionStream ¶
PrintChatCompletionStream prints the chat completion stream to the console
func PrintColoredText ¶
func PrintColoredText(text, cssColorCode string)
PrintColoredText prints the given text in the specified CSS color code using fmt.Print.
func PrintColoredTextLn ¶
func PrintColoredTextLn(text, cssColorCode string)
PrintColoredTextLn prints the given text in the specified CSS color code using fmt.Println.
func RemoveQuotes ¶
RemoveQuotes removes any quotes from a string using regex.
func ReplaceLines ¶ added in v0.0.3
ReplaceLines replaces the lines between the startLine and endLine with the new text.
func ReverseSlice ¶
func ReverseSlice[T any](s []T)
ReverseSlice reverses the order of the elements in a slice of any type.
func StartsWithAny ¶ added in v0.0.3
StartsWithAny takes a string and a slice of prefixes and returns true if the string starts with any of the prefixes.
func StringInSlice ¶
StringInSlice checks if a string is in a slice of strings
func StringSliceToAnySlice ¶
StringSliceToAnySlice converts a slice of strings to a slice of any.
Types ¶
This section is empty.