Documentation
¶
Index ¶
- Constants
- Variables
- func NewSkipMode(c gad.Call) (_ gad.Object, err error)
- func Walk(c gad.Call) (_ gad.Object, err error)
- type WalkSkip
- func (f *WalkSkip) Clear(flag WalkSkip) *WalkSkip
- func (f WalkSkip) Equal(right gad.Object) bool
- func (f WalkSkip) Has(flag WalkSkip) bool
- func (f WalkSkip) IsFalsy() bool
- func (f *WalkSkip) Parse(str string)
- func (f *WalkSkip) Set(flag WalkSkip) *WalkSkip
- func (f WalkSkip) String() string
- func (f WalkSkip) ToString() string
- func (f *WalkSkip) Toggle(flag WalkSkip) *WalkSkip
- func (f WalkSkip) Type() gad.ObjectType
Constants ¶
View Source
const ModuleName = "filepath"
Variables ¶
View Source
var ( TWalkIterator = gad.NewType("WalkIterator", gad.TIterator) ModuleInit = gad.ModuleInitFunc(func(module *gad.Module, c gad.Call) (err error) { spec := module.Spec module.Data = gad.Dict{ "ext": gad.MustNewReflectValue(filepath.Ext), "clean": gad.MustNewReflectValue(filepath.Clean), "join": gad.MustNewReflectValue(filepath.Join), "base": gad.MustNewReflectValue(filepath.Base), "dir": gad.MustNewReflectValue(filepath.Dir), "isAbs": gad.MustNewReflectValue(filepath.IsAbs), "isLocal": gad.MustNewReflectValue(filepath.IsLocal), "rel": gad.MustNewReflectValue(filepath.Rel), "volumeName": gad.MustNewReflectValue(filepath.VolumeName), "split": gad.MustNewReflectValue(filepath.Split), "match": gad.MustNewReflectValue(filepath.Match), "fromSlash": gad.MustNewReflectValue(filepath.FromSlash), "evalSymlinks": gad.MustNewReflectValue(filepath.EvalSymlinks), "walk": &gad.BuiltinFunction{ Module: spec, FuncName: "walk", Value: Walk, }, TWalkSkip.Name(): TWalkSkip, "glob": &gad.BuiltinFunction{ Module: spec, FuncName: "glob", Value: func(c gad.Call) (_ gad.Object, err error) { if err = c.Args.CheckLen(1); err != nil { return } var ( matched []string arr gad.Array ) if matched, err = filepath.Glob(c.Args.GetOnly(0).ToString()); err != nil { return } arr = make(gad.Array, len(matched)) for i, v := range matched { arr[i] = gad.Str(v) } return arr, nil }, }, "splitList": &gad.BuiltinFunction{ Module: spec, FuncName: "splitList", Value: func(c gad.Call) (_ gad.Object, err error) { if err = c.Args.CheckLen(1); err != nil { return } var ( s = filepath.SplitList(c.Args.GetOnly(0).ToString()) arr = make(gad.Array, len(s)) ) for i, v := range s { arr[i] = gad.Str(v) } return arr, nil }, }, } return }) )
View Source
var TWalkSkip = gad.NewType("WalkSkip"). WithConstructor(&gad.Function{ Value: NewSkipMode, }). WithStatic(gad.Dict{ "None": WalkSkipNone, "Dir": WalkSkipDir, "All": WalkSkipAll, })
Functions ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.