Documentation
¶
Overview ¶
Package fstree creates or check filesystem tree structure driven by yaml.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Make ¶
Make makes filesystem tree in rootPath from yamlData. For example:
configs: "config1.txt": type: file data: "format: txt" pkg: pkg1: type: link path: "../../pkg1"
The function creates:
- ./configs/config1.txt (file with data "format: txt")
- ./pkg/pkg1 (link points to "../../pkg1")
func MakeOverOSFS ¶
MakeOverOSFS makes the same thing as Make, but uses the real filesystem
Types ¶
type CheckFS ¶ added in v1.2.0
type CheckFS interface { IsExist(path string) bool IsFile(path string) bool IsLink(path string) bool IsDirectory(path string) bool ReadDir(path string) ([]string, error) ReadFile(path string) ([]byte, error) Readlink(path string) (string, error) }
CheckFS describes required interface for checking filetree. In the most cases it copies os package signatures.
type Difference ¶ added in v1.2.0
Difference type describes specific difference between filesystem and check expectation
func Check ¶ added in v1.2.0
func Check(fs CheckFS, rootPath string, yamlData string) (*Difference, error)
Check checks filesystem tree in rootPath by yamlData. For example:
configs: config1.txt: type: file data: some data pkg: pkg1: type: link path: "../../pkg1"
The function checks:
- that ./configs/config1.txt is a file with data "some data"
- that ./pkg/pkg1 is a link that points to "../../pkg1"
func CheckOverOSFS ¶ added in v1.2.0
func CheckOverOSFS(rootPath string, yamlData string) (*Difference, error)
CheckOverOSFS makes the same thing as Check, but uses the real filesystem
type MakerFS ¶ added in v1.2.0
type MakerFS interface { IsExist(path string) bool IsFile(path string) bool IsLink(path string) bool IsDirectory(path string) bool ReadFile(path string) ([]byte, error) Readlink(path string) (string, error) WriteFile(path string, data []byte) error Symlink(oldPath, newPath string) error Mkdir(path string) error }
MakerFS describes required interface for making filetree. In the most cases it copies os package signatures.
Directories
¶
Path | Synopsis |
---|---|
Package checker makes compliance check with filesystem tree structure.
|
Package checker makes compliance check with filesystem tree structure. |
Package config parses user config to abstract fs node structure.
|
Package config parses user config to abstract fs node structure. |
Package maker makes filesystem tree by passed filesystem entries
|
Package maker makes filesystem tree by passed filesystem entries |
Package osfs describes OsFS type that implements work with filesystem by os package.
|
Package osfs describes OsFS type that implements work with filesystem by os package. |