dir

package
v0.0.0-...-cca5969 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package dir has been designed to list files within a certain directory excluding files from ignore list.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller interface {
	SetIgnore([]string)
	Ignore() []string
	AbsPath() string
	RelPath() string
	Base() string
	Dir() string
	IsPathIgnored(string) bool
	ListFiles(...string) ([]string, int64, error)
}

Controller is the interface that wraps the Dir methods.

type Dir

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

Dir represents a working directory.

func New

func New(path string) (*Dir, error)

New creates a new Dir instance.

func (*Dir) AbsPath

func (d *Dir) AbsPath() string

AbsPath returns an absolute path.

func (*Dir) Base

func (d *Dir) Base() string

Base returns a base path.

func (*Dir) Dir

func (d *Dir) Dir() string

Dir returns a directory.

func (*Dir) Ignore

func (d *Dir) Ignore() []string

Ignore gets ignore list.

func (*Dir) IsPathIgnored

func (d *Dir) IsPathIgnored(path string) bool

IsPathIgnored checks if the provided path is ignored based on ignore.

func (*Dir) ListFiles

func (d *Dir) ListFiles(ext ...string) (path []string, size int64, err error)

ListFiles lists all files and their size in total from the based on ignore.

func (*Dir) RelPath

func (d *Dir) RelPath() string

RelPath returns a relative path.

func (*Dir) SetIgnore

func (d *Dir) SetIgnore(ignore []string)

SetIgnore sets ignore list.

Jump to

Keyboard shortcuts

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