Documentation
¶
Overview ¶
Package mktree implements a language for generating boilerplate files and directories.
Example (Dir) ¶
interpret(`(dir "test")`)
Output: drwxrwxrwx [example] drwxrwxrwx [example]/test
Example (File) ¶
interpret(`(file "test")`)
Output: drwxrwxrwx [example] -rw-rw-rw- [example]/test 0
Example (Parent_dirs) ¶
interpret(`(file "/a/b/c/d/e.txt")`)
Output: drwxrwxrwx [example] -rw-rw-rw- [example]/a/b/c/d/e.txt 0
Example (Perms) ¶
interpret(` (dir "a" (@perms 0700)) (file "b" (@perms 0755)) `)
Output: drwxrwxrwx [example] drwx------ [example]/a -rwxr-xr-x [example]/b 0
Example (Tree_with_perms) ¶
interpret(` (dir "a" (@perms 0700) (file "b" (@perms 0755))) `)
Output: drwxrwxrwx [example] drwx------ [example]/a -rwxr-xr-x [example]/a/b 0
Example (Vars) ¶
interpretVars(` (dir "%(dirname)" (@perms %(perms))) (file "%(filename)" (@perms %(perms))) (dir "%(root_dir)") `, map[string]string{ "dirname": "a", "filename": "b.txt", "perms": "0555", })
Output: drwxrwxrwx [example] dr-xr-xr-x [example]/a drwxrwxrwx [example]/[example] -r-xr-xr-x [example]/b.txt 0
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInterpret = errors.New("interpet error")
Functions ¶
Types ¶
type Dir ¶
func (*Dir) DebugPrint ¶ added in v1.1.0
type File ¶
func (*File) DebugPrint ¶ added in v1.1.0
type Interpreter ¶
type Interpreter struct { Root string Vars map[string]string AllowUndefinedVars bool Stderr io.Writer }
type Option ¶ added in v1.1.0
type Option interface {
// contains filtered or unexported methods
}
func WithTemplateFunction ¶ added in v1.1.0
type Tree ¶ added in v1.1.0
type Tree struct {
// contains filtered or unexported fields
}
func (*Tree) DebugPrint ¶ added in v1.1.0
Source Files
¶
Click to show internal directories.
Click to hide internal directories.