github.com/bingoohuang/pkger@v0.0.0-20210127185155-a71b9df4c4c7/pkging/pkger.go (about)

     1  package pkging
     2  
     3  import (
     4  	"os"
     5  	"path/filepath"
     6  
     7  	"github.com/bingoohuang/pkger/here"
     8  )
     9  
    10  type Pkger interface {
    11  	// Parse the string in here.Path format.
    12  	Parse(p string) (here.Path, error)
    13  
    14  	// Current returns the here.Info representing the current Pkger implementation.
    15  	Current() (here.Info, error)
    16  
    17  	// Info returns the here.Info of the here.Path
    18  	Info(p string) (here.Info, error)
    19  
    20  	// Create creates the named file with mode 0666 (before umask) - It's actually 0644, truncating it if it already exists. If successful, methods on the returned File can be used for I/O; the associated file descriptor has mode O_RDWR.
    21  	Create(name string) (File, error)
    22  
    23  	// MkdirAll creates a directory named path, along with any necessary parents, and returns nil, or else returns an error. The permission bits perm (before umask) are used for all directories that MkdirAll creates. If path is already a directory, MkdirAll does nothing and returns nil.
    24  	MkdirAll(p string, perm os.FileMode) error
    25  
    26  	// Open opens the named file for reading. If successful, methods on the returned file can be used for reading; the associated file descriptor has mode O_RDONLY.
    27  	// @Parser Directive
    28  	Open(name string) (File, error)
    29  
    30  	// Stat returns a FileInfo describing the named file.
    31  	// @Parser Directive
    32  	Stat(name string) (os.FileInfo, error)
    33  
    34  	// Walk walks the file tree rooted at root, calling walkFn for each file or directory in the tree, including root. All errors that arise visiting files and directories are filtered by walkFn. The files are walked in lexical order, which makes the output deterministic but means that for very large directories Walk can be inefficient. Walk does not follow symbolic links. - That is from the standard library. I know. Their grammar teachers can not be happy with them right now.
    35  	// @Parser Directive
    36  	Walk(p string, wf filepath.WalkFunc) error
    37  
    38  	// Remove removes the named file or (empty) directory.
    39  	Remove(name string) error
    40  
    41  	// RemoveAll removes path and any children it contains. It removes everything it can but returns the first error it encounters. If the path does not exist, RemoveAll returns nil (no error).
    42  	RemoveAll(path string) error
    43  }