files

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2020 License: Apache-2.0 Imports: 8 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckNotEmptyAndExists

func CheckNotEmptyAndExists(file string) error

CheckNotEmptyAndExists returns an error if the given file does not exist exists or is empty

func Pwd

func Pwd() (string, error)

Pwd returns the process working directory

func ReadInput

func ReadInput(path string) ([]byte, error)

ReadInput reads bytes from inputPath (if not empty) or stdin

func ToAbsPath

func ToAbsPath(path, root string) (string, error)

ToAbsPath turns a relative path into an absolute path with the given root path, absolute paths are ignored

func WriteOutput

func WriteOutput(path string, contents []byte, perm os.FileMode) error

WriteOutput writes given bytes into outputPath (if not empty) or stdout

Types

type ErrExpectedStdin

type ErrExpectedStdin struct {
	// contains filtered or unexported fields
}

ErrExpectedStdin indicates that an stdin pipe was expected but not present

func NewErrExpectedStdin added in v0.0.8

func NewErrExpectedStdin() *ErrExpectedStdin

NewErrExpectedStdin creates a new ErrExpectedStdin

func (*ErrExpectedStdin) Error added in v0.0.8

func (e *ErrExpectedStdin) Error() string

func (*ErrExpectedStdin) Format added in v0.0.8

func (e *ErrExpectedStdin) Format(s fmt.State, verb rune)

Format implements fmt.Formatter used by Sprint(f) or Fprint(f) etc.

func (*ErrExpectedStdin) StackTrace added in v0.0.8

func (e *ErrExpectedStdin) StackTrace() errors.StackTrace

StackTrace returns a stack trace for this error

type FileEntry added in v0.0.5

type FileEntry struct {
	Path      string
	Name      string
	Extension string
}

FileEntry contains file information

func DirTree added in v0.0.5

func DirTree(input string) (entries []FileEntry, err error)

DirTree returns files form all directories and subdirectories

func TrimExtension added in v0.0.5

func TrimExtension(file FileEntry, extensions []string) (new FileEntry)

TrimExtension returns file without given extensions

Jump to

Keyboard shortcuts

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