IO

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ColorReset = "\033[0m"
	ColorRed   = "\033[31m"
	ColorGreen = "\033[32m"
	ColorCyan  = "\033[36m"
	ColorPink  = "\033[38;5;205m"
	ColorGold  = "\033[38;2;243;134;48m"
)

Variables

View Source
var NotFoundError = errors.New("Info not found while fetching data")

Functions

func DeleteSentenceFromFile

func DeleteSentenceFromFile(filePath, searchString string) error

func FilterSentenceFromFile

func FilterSentenceFromFile(fsys fs.FS, filePath string, searchString string) ([]byte, error)

func GetHomeDir

func GetHomeDir() string

func GetWords

func GetWords(fsys fs.FS, filename string, numberOfLines int) ([]string, error)

func HttpGetDictionary

func HttpGetDictionary[T any](parser func(io.Reader, int) (T, error), url string) (T, error)

func MoveSentenceToFile

func MoveSentenceToFile(trashPath, wordsPath, sentence string) error

func OverrideFile

func OverrideFile(data []byte, filepath string) error

func PrintGreen

func PrintGreen(out io.Writer, message string)

func PrintRed

func PrintRed(out io.Writer, message string)

func PrintWithColor

func PrintWithColor(out io.Writer, message, color string)

func WriteFile

func WriteFile(sentence, filepath string) error

Types

type File

type File struct {
	FilePath string
}

func (File) ReadFile

func (f File) ReadFile() string

type IFile

type IFile interface {
	ReadFile() string
}

type UserFilePath

type UserFilePath struct {
	WriteFile        string
	ManualInsertFile string
	TrashFile        string
}

Jump to

Keyboard shortcuts

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