view

package
v0.0.0-...-80c8c53 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NoOpExclusion

func NoOpExclusion(_ string) bool

Types

type DirectoryView

type DirectoryView interface {
	Dir() string
	Files() []string
}

DirectoryView is an object that provides methods to list files within the directory and to get the directory path itself. Dir should return the whole path to the directory, and Files should return only filenames that exist within given directory.

func NewDirectory

func NewDirectory(rootDir string) (DirectoryView, error)

NewDirectory creates DirectoryView of given directory providing the directory path and filenames that are inside the directory.

func NewDirectoryWithExclusion

func NewDirectoryWithExclusion(rootDir string, fileExclusionFunc FileExclusionFunc) (DirectoryView, error)

NewDirectoryWithExclusion creates DirectoryView of given directory providing the directory path and filenames that are inside the directory. It uses FileExclusionFunc to exclude files that are undesirable in the final view.

func NewFile

func NewFile(path string) (DirectoryView, error)

NewFile creates DirectoryView of file providing its parent dir and single-item list with the given file.

func NewFileWithExclusion

func NewFileWithExclusion(path string, fileExclusionFunc FileExclusionFunc) (DirectoryView, error)

NewFileWithExclusion creates DirectoryView and uses FileExclusionFunc to exclude file if it is undesirable in the final view, thus the final view may be empty.

type FileExclusionFunc

type FileExclusionFunc func(string) bool

Jump to

Keyboard shortcuts

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