label

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLabel = errors.New("invalid label passed")
	ErrMissingLabel = errors.New("missing file for label(s) passed")
)

Functions

func Format

func Format(labels []string) []string

Format formats and strips out any invalid characters from provided labels. Invalid character is anything that [^a-z0-9-] does match.

func Open

func Open(rootDir string, labels []string, flag int) (*os.File, error)

Open validates and opens the file constructed from the labels. If the file does not exist or some labels are invalid, returns ErrMissingLabel and ErrInvalidLabel respectively. If os.O_CREATE flag is passed and the file does not exist, it is created with mode perm config.StdFileMode.

func OpenFuzzy added in v0.2.0

func OpenFuzzy(rootDir string, labels []string, flag int) (*os.File, error)

OpenFuzzy performs the same action as Open but picks the file based on a ranked fuzzy match on given labels.

func Remove

func Remove(rootDir string, labels []string) error

Remove validates and removes the file constructed from the labels. If the file does not exist, has no effect.

Types

This section is empty.

Jump to

Keyboard shortcuts

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