fsh

package
v0.33.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultDirPerm = 0o755

Variables

This section is empty.

Functions

func Abs added in v0.29.0

func Abs(fSys FS, path string) (string, error)

func DirSize added in v0.30.0

func DirSize(fSys FS, path string) (int64, error)

func ExpandTilde added in v0.29.0

func ExpandTilde(fs FS, path string) (string, error)

func IsExists

func IsExists(fSys FS, path string) bool

func ReadJson

func ReadJson[T any](fs FS, path string) (*T, error)

func ReadOrCreateJson

func ReadOrCreateJson[T any](fs FS, path string, defaultVal T) (*T, error)

func WriteJson

func WriteJson(fs FS, in any, path string) error

Types

type FS

type FS interface {
	afero.Fs
	afero.Linker
	GetCurrentDir() string
	GetHomeDir() (string, error)
	Walk(root string, fn filepath.WalkFunc) error
}

func NewRealFS

func NewRealFS() FS

type MemFS

type MemFS struct {
	afero.Fs
}

func NewMemFS

func NewMemFS(files map[string]string) *MemFS

func (*MemFS) GetCurrentDir added in v0.29.0

func (m *MemFS) GetCurrentDir() string

func (*MemFS) GetHomeDir added in v0.29.0

func (m *MemFS) GetHomeDir() (string, error)

func (*MemFS) GetTree

func (m *MemFS) GetTree(dir string) ([]string, error)

func (*MemFS) SymlinkIfPossible

func (m *MemFS) SymlinkIfPossible(oldname, newname string) error

func (*MemFS) Walk added in v0.30.0

func (m *MemFS) Walk(root string, fn filepath.WalkFunc) error

type RealFs added in v0.29.0

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

func (*RealFs) Chmod added in v0.29.0

func (r *RealFs) Chmod(name string, mode os.FileMode) error

func (*RealFs) Chown added in v0.29.0

func (r *RealFs) Chown(name string, uid, gid int) error

func (*RealFs) Chtimes added in v0.29.0

func (r *RealFs) Chtimes(name string, atime time.Time, mtime time.Time) error

func (*RealFs) Create added in v0.29.0

func (r *RealFs) Create(name string) (afero.File, error)

func (*RealFs) GetCurrentDir added in v0.29.0

func (r *RealFs) GetCurrentDir() string

func (*RealFs) GetHomeDir added in v0.29.0

func (r *RealFs) GetHomeDir() (string, error)

func (*RealFs) Mkdir added in v0.29.0

func (r *RealFs) Mkdir(name string, perm os.FileMode) error

func (*RealFs) MkdirAll added in v0.29.0

func (r *RealFs) MkdirAll(path string, perm os.FileMode) error

func (*RealFs) Name added in v0.29.0

func (r *RealFs) Name() string

func (*RealFs) Open added in v0.29.0

func (r *RealFs) Open(name string) (afero.File, error)

func (*RealFs) OpenFile added in v0.29.0

func (r *RealFs) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error)

func (*RealFs) Remove added in v0.29.0

func (r *RealFs) Remove(name string) error

func (*RealFs) RemoveAll added in v0.29.0

func (r *RealFs) RemoveAll(path string) error

func (*RealFs) Rename added in v0.29.0

func (r *RealFs) Rename(oldname, newname string) error

func (*RealFs) Stat added in v0.29.0

func (r *RealFs) Stat(name string) (os.FileInfo, error)

func (*RealFs) SymlinkIfPossible added in v0.29.0

func (r *RealFs) SymlinkIfPossible(oldname, newname string) error

func (*RealFs) Walk added in v0.30.0

func (r *RealFs) Walk(root string, fn filepath.WalkFunc) error

Jump to

Keyboard shortcuts

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