files

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package files provides utilities for managing collections of files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Files

type Files []file.File

Files represents a collection of filesystem paths. Provides batch operations for working with multiple files.

func New

func New(dir string, paths ...string) (fs Files)

New creates a Files collection from path strings. Joins each path with the provided directory to create full paths. Empty paths are skipped, and an empty directory uses paths as-is.

func (*Files) Add added in v0.1.0

func (fs *Files) Add(dir, path string)

Add adds a new file to the collection. Joins the provided path with the directory to create a full path.

func (*Files) AddFile added in v0.1.0

func (fs *Files) AddFile(f file.File)

AddFile adds a file to the collection. If the file already exists in the collection, it is not added again.

func (Files) AsSlice added in v0.0.18

func (fs Files) AsSlice() []string

AsSlice converts the Files collection to a slice of strings.

func (Files) Contains added in v0.1.0

func (fs Files) Contains(file file.File) bool

Contains checks if the collection contains a specified file.

func (*Files) Existing added in v0.1.11

func (fs *Files) Existing()

Existing prunes the collection to only include existing files.

func (Files) Exists added in v0.0.13

func (fs Files) Exists() (file.File, bool)

Exists returns the first file in the collection that exists.

func (*Files) Expanded added in v0.1.6

func (fs *Files) Expanded()

Expanded expands all files in the collection.

func (Files) LinksFor added in v0.0.13

func (fs Files) LinksFor(file file.File) error

LinksFor creates links for each file in the collection. Creates a link at each path in the collection, pointing to the specified target file. See file.File.Links for more details.

func (*Files) RelativeTo added in v0.1.5

func (fs *Files) RelativeTo(base string) Files

RelativeTo makes all files in the collection relative to the specified base directory.

func (*Files) Remove added in v0.1.0

func (fs *Files) Remove(file file.File) bool

Remove removes a file from the collection. Returns true if the file was found and removed, false otherwise.

Jump to

Keyboard shortcuts

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