Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ItemGetter ¶
type ItemGetter struct {
Path, Filter string
Include, Exclude, Extension []string
Directory, Recurse bool
}
ItemGetter is the helper struct for the GetItems method Fields can be set one by one, mis-modifications to Path gets fixed by fixPath
func NewItemGetter ¶
func NewItemGetter(path string) *ItemGetter
NewItemGetter inits ItemGetter with path and returns a ItemGetter struct.
func (*ItemGetter) GetItems ¶
func (IG *ItemGetter) GetItems() (dirEntries []os.DirEntry, err error)
GetItems is a Go native Get-ChildItem from PowerShell, although not all flags are provided. See https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-childitem for params info. path will default to "." if empty, everything else can be the initial value for the var type if not required.
Filter is cross-platform case-sensitive Include and Exclude are case-insensitive on Windows Extension is case-insensitive
func (*ItemGetter) GetItemsString ¶
func (IG *ItemGetter) GetItemsString() ([]string, error)
GetItemsString collects filenames and returns a slice of string. Calls GetItems and appends each os.DirEntry.Name() to returned []string.