Documentation ¶
Overview ¶
Package egFilePath provides filepath manupilation functionalities.
egFilePath provides filepath manupilation manipulation, provided by "path/filepath".
Example ¶
for standalone test, change package to `main` and the next func def to, func main() {
package main import ( "os" "github.com/go-easygen/easygen" "github.com/go-easygen/easygen/egFilePath" ) // for standalone test, change package to `main` and the next func def to, // func main() { func main() { tmpl0 := easygen.NewTemplate().Customize() tmpl := tmpl0.Funcs(easygen.FuncDefs()).Funcs(egFilePath.FuncDefs()) err := easygen.Process0(tmpl, os.Stdout, // https://godoc.org/path/filepath "Base: {{fpBase `/a/b.c`}}, {{fpBase `/b.c/`}}, {{fpBase `./b.c`}}, {{fpBase `b.c`}}\n"+ "Clean: {{fpClean `/a//b.c/./..`}}, {{fpClean `//b.c///`}}, {{fpClean `/../b.c`}}\n"+ "Dir: {{fpDir `/a/b/c`}}, {{fpDir `/b/c/`}}, {{fpDir `./b/c`}}, {{fpDir `b.c`}}\n"+ "Ext: {{fpExt `index`}}, {{fpExt `index.js`}}, {{fpExt `main.test.js`}}\n"+ "Join: {{fpJoin `/a` `b` `c` `a//` `//b////c`}}, {{fpJoin `a` `b/c`}}, {{fpJoin `a/b` `c`}}\n"+ "Rel: {{fpRel `/a` `/a/b/c`}}, {{fpRel `/a` `/b/c`}}\n"+ // Two error cases, uncomment to verify // "{{fpRel `/a` `./b/c`}}, {{isDir `not-exist`}}.\n"+ "IsDir: {{isDir `.`}}.\n"+ "Basename: {{basename `/a/b.c`}}, {{basename `/b.c/`}}, {{basename `b.c`}}, {{basename `bc`}}", "../test/var0") if err != nil { panic(err) } } // To show the full code in GoDoc type dummy struct { }
Output: Base: b.c, b.c, b.c, b.c Clean: /a, /b.c, /b.c Dir: /a/b, /b/c, b, . Ext: , .js, .js Join: /a/b/c/a/b/c, a/b/c, a/b/c Rel: b/c, ../b/c IsDir: true. Basename: b, b, b, bc
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EgFilePath ¶
EgFilePath -- EasyGen FilePath manupilation functionalities
fpAbs is wrapper for filepath.Abs fpBase is wrapper for filepath.Base fpClean is wrapper for filepath.Clean fpDir is wrapper for filepath.Dir fpEvalSymlinks is wrapper for filepath.EvalSymlinks fpExt is wrapper for filepath.Ext fpFromSlash is wrapper for filepath.FromSlash fpGlob is wrapper for filepath.Glob fpHasPrefix is wrapper for filepath.HasPrefix fpIsAbs is wrapper for filepath.IsAbs fpJoin is wrapper for filepath.Join fpMatch is wrapper for filepath.Match fpRel is wrapper for filepath.Rel fpSplitList is wrapper for filepath.SplitList fpToSlash is wrapper for filepath.ToSlash fpVolumeName is wrapper for filepath.VolumeName isDir is template function for IsDir basename is template function for Basename
Click to show internal directories.
Click to hide internal directories.