fsutils

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvalSymlinks(path string) (string, error)

func Getwd

func Getwd() (string, error)

func IsDir

func IsDir(filename string) bool

func NormalizePathInRegex

func NormalizePathInRegex(path string) string

NormalizePathInRegex it's a noop function on Unix.

func PrettifyBytesCount

func PrettifyBytesCount(n int64) string

func ShortestRelPath

func ShortestRelPath(path, wd string) (string, error)

func UseWdCache

func UseWdCache(use bool)

func WithPathPrefix

func WithPathPrefix(pathPrefix, relativePath string) string

WithPathPrefix takes a path that is relative to the current directory (as used in issues) and adds the configured path prefix, if there is one. The resulting path then can be shown to the user or compared against paths specified in the configuration.

Types

type FileCache

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

func NewFileCache

func NewFileCache() *FileCache

func (*FileCache) GetFileBytes

func (fc *FileCache) GetFileBytes(filePath string) ([]byte, error)

func (*FileCache) PrintStats

func (fc *FileCache) PrintStats(log logutils.Log)

type Files

type Files struct {
	*LineCache
	// contains filtered or unexported fields
}

Files combines different operations related to handling file paths and content.

func NewFiles

func NewFiles(lc *LineCache, pathPrefix string) *Files

func (*Files) WithPathPrefix

func (f *Files) WithPathPrefix(relativePath string) string

WithPathPrefix takes a path that is relative to the current directory (as used in issues) and adds the configured path prefix, if there is one. The resulting path then can be shown to the user or compared against paths specified in the configuration.

type LineCache

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

func NewLineCache

func NewLineCache(fc *FileCache) *LineCache

func (*LineCache) GetLine

func (lc *LineCache) GetLine(filePath string, index1 int) (string, error)

GetLine returns the index1-th (1-based index) line from the file on filePath

Jump to

Keyboard shortcuts

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