filter

package
v0.0.0-...-2ad2f98 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package filter implements Accept/Reject filtering of file.Names.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

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

Filter filenames by the accept/reject regexs.

func New

func New(accept, reject string) (*Filter, error)

New returns a new *Filter.

If accept is a non-empty regex string and it matches the filename then file will be processed. Leave the empty string to accept all files.

If reject is a non-empty regex string and it matches the filename then the file will be ignored. Leave the empty string to disable rejection.

If both regexs are set and either causes a file to be rejected then the file will be rejected.

func (*Filter) Reject

func (f *Filter) Reject(name string) bool

Reject returns true if the file should be rejected based on its name.

Jump to

Keyboard shortcuts

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