utils

package
v1.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupTempFiles

func CleanupTempFiles(dir string) error

CleanupTempFiles Cleanup temporary files

func ConfirmPrompt added in v1.3.0

func ConfirmPrompt(path string) (bool, error)

ConfirmPrompt PromptUser prompts the user to accept or reject the changes with a charming interface

func DetectLanguageFromCodeBlock added in v1.3.3

func DetectLanguageFromCodeBlock(content string) string

func GetGitignorePatterns

func GetGitignorePatterns() ([]string, error)

GetGitignorePatterns reads and returns the patterns from the .gitignore file. If the file does not exist, it returns an empty pattern list.

func GetSupportedLanguage

func GetSupportedLanguage(path string) string

func GracefulShutdown

func GracefulShutdown(done chan bool, TempFilesCleanup func(), chatHistoryCleanUp func())

func InputPrompt added in v1.3.0

func InputPrompt(reader *bufio.Reader) (string, error)

InputPrompt prompts the user to enter their request for code assistance in a charming way

func IsDefaultIgnored

func IsDefaultIgnored(path string) bool

func IsGitIgnored

func IsGitIgnored(path string, patterns []string) bool

IsGitIgnored checks if a file path matches any of the patterns in .gitignore.

func RenderAndPrintMarkdown added in v1.3.0

func RenderAndPrintMarkdown(content string, language string, theme string) error

RenderAndPrintMarkdown handles the rendering of markdown content,

func RetryWithBackoff

func RetryWithBackoff(operation func() error, maxRetries uint64) error

RetryWithBackoff Function to encapsulate the retry logic with backoff

func WriteToTempFile

func WriteToTempFile(relativePath string, code string) (string, error)

WriteToTempFile code to a temporary file (without overwriting the original)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL