utils

package
v0.1.2-0...-4abb174 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LoggerService = &logger{}

LoggerService is the default logger instance

Functions

func GetFilesFromGlobs

func GetFilesFromGlobs(patterns []string) (files []string)

GetFilesFromGlobs is a function that finds files from glob patterns

func GetUserHomeDir

func GetUserHomeDir(userProfile func() (*user.User, error)) string

GetUserHomeDir returns the current user home directory

func PromptConfirmation

func PromptConfirmation(text string) bool

PromptConfirmation is a function that ask for user confirmation

func ReadInput

func ReadInput(separator string) string

ReadInput is a function that reads the user input

func ThrowError

func ThrowError(err string)

ThrowError throws an error and exit the tool

Types

type FileProcessor

type FileProcessor struct {
	Files []string
}

FileProcessor is a type

func (*FileProcessor) FileExists

func (p *FileProcessor) FileExists(path string) bool

FileExists is a FileProcessor method to check if a file exists

func (*FileProcessor) FileIsWritable

func (p *FileProcessor) FileIsWritable(path string) bool

FileIsWritable is a FileProcessor method to check if a file is writable

func (*FileProcessor) Proceed

func (p *FileProcessor) Proceed(cb func(path string))

Proceed is a FileProcessor method to call an anonymous function for each registered file

func (*FileProcessor) Register

func (p *FileProcessor) Register(path string) *FileProcessor

Register is a FileProcessor method to add a file to process

Jump to

Keyboard shortcuts

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