content

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindFiles

func FindFiles(dirPath string, ext string) ([]string, error)

FindFiles searches for files with a specific extension in the given root directory and its subdirectories.

Parameters:

  • root: The root directory to start the search from.
  • ext: The file extension to search for. examples: ".md", ".html", ".txt", "*.*"

Returns: - []string: A slice of file paths that match the given extension. - error: An error if the search encounters any issues.

func ForEachFile

func ForEachFile(dirPath string, ext string, callback func(string) error) ([]string, error)

ForEachFile iterates over all files with a specific extension in a directory and its subdirectories.

Parameters: - dirPath: The root directory to start the search from. - ext: The file extension to search for. - callback: A function to be called for each file found.

Returns: - []string: A slice of file paths that match the given extension. - error: An error if the search encounters any issues.

func GenerateContextFromDocs

func GenerateContextFromDocs(docs []string) string

GenerateContextFromDocs generates the context content from a slice of documents.

Remarks: you can use the generated content to add context to a prompt for an LLM.

Parameters: - docs: a slice of strings representing the documents.

Returns: - string: the generated context content in XML format.

func GetArrayOfContentFiles

func GetArrayOfContentFiles(dirPath string, ext string) ([]string, error)

GetArrayOfContentFiles searches for files with a specific extension in the given directory and its subdirectories.

Parameters: - dirPath: The directory path to start the search from. - ext: The file extension to search for.

Returns: - []string: A slice of file paths that match the given extension. - error: An error if the search encounters any issues.

func GetMapOfContentFiles

func GetMapOfContentFiles(dirPath string, ext string) (map[string]string, error)

GetMapOfContentFiles searches for files with a specific extension in the given directory and its subdirectories.

Parameters: - dirPath: The directory path to start the search from. - ext: The file extension to search for.

Returns: - map[string]string: A map of file paths to their contents, where the keys are the base names of the files and the values are the file contents as strings. - error: An error if the search encounters any issues.

Types

This section is empty.

Jump to

Keyboard shortcuts

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