Documentation ¶
Index ¶
- Constants
- Variables
- func FillBlank(s string, length int) string
- type ContentFilter
- func (cf *ContentFilter) AppendToLengthFixed(fixed ...LengthFixed)
- func (cf *ContentFilter) AppendToNoOutputOptions(options ...NoOutputOption)
- func (cf *ContentFilter) AppendToOptions(options ...ContentOption)
- func (cf *ContentFilter) EnableGroup(renderer *render.Renderer) ContentOption
- func (cf *ContentFilter) EnableOwner(renderer *render.Renderer) ContentOption
- func (cf *ContentFilter) EnableSum(sumTypes ...SumType) ContentOption
- func (cf *ContentFilter) GetDisplayItems(e ...os.FileInfo) []*display.Item
- func (cf *ContentFilter) SetNoOutputOptions(outputFunc ...NoOutputOption)
- func (cf *ContentFilter) SetOptions(options ...ContentOption)
- func (cf *ContentFilter) SetSortFunc(sortFunc func(a, b os.FileInfo) bool)
- func (cf *ContentFilter) SortFunc() func(a, b os.FileInfo) bool
- type ContentFilterOption
- type ContentOption
- type ItemFilter
- type ItemFilterFunc
- func ExtOnly(ext ...string) ItemFilterFunc
- func GlobOnly(globPattern ...string) (ItemFilterFunc, error)
- func MimeTypeOnly(fileTypes ...string) ItemFilterFunc
- func RemoveByExt(ext ...string) ItemFilterFunc
- func RemoveGitIgnore(repoPath git.GitRepoPath) ItemFilterFunc
- func RemoveGlob(globPattern ...string) (ItemFilterFunc, error)
- func RemoveMimeType(fileTypes ...string) ItemFilterFunc
- type LengthFixed
- type NoOutputOption
- type SumType
Constants ¶
View Source
const ( OwnerName = "Owner" OwnerUidName = "Owner-uid" OwnerSID = "Owner-sid" )
View Source
const ( GroupName = "Group" GroupUidName = "Group-uid" GroupSID = "Group-sid" )
View Source
const SumName = "Sum"
Variables ¶
View Source
var ( Uid = false Gid = false )
View Source
var DirOnly = func(e os.FileInfo) bool {
return e.IsDir()
}
View Source
var RemoveBackups = func(e os.FileInfo) bool { return !strings.HasSuffix(e.Name(), "~") }
View Source
var RemoveDir = func(e os.FileInfo) bool {
return !e.IsDir()
}
Functions ¶
Types ¶
type ContentFilter ¶
type ContentFilter struct { LimitN uint // <=0 means no limit // contains filtered or unexported fields }
func NewContentFilter ¶
func NewContentFilter(options ...ContentFilterOption) *ContentFilter
func (*ContentFilter) AppendToLengthFixed ¶ added in v0.5.1
func (cf *ContentFilter) AppendToLengthFixed(fixed ...LengthFixed)
func (*ContentFilter) AppendToNoOutputOptions ¶ added in v0.8.0
func (cf *ContentFilter) AppendToNoOutputOptions(options ...NoOutputOption)
func (*ContentFilter) AppendToOptions ¶ added in v0.5.0
func (cf *ContentFilter) AppendToOptions(options ...ContentOption)
func (*ContentFilter) EnableGroup ¶ added in v0.3.1
func (cf *ContentFilter) EnableGroup(renderer *render.Renderer) ContentOption
func (*ContentFilter) EnableOwner ¶ added in v0.3.1
func (cf *ContentFilter) EnableOwner(renderer *render.Renderer) ContentOption
func (*ContentFilter) EnableSum ¶ added in v0.5.0
func (cf *ContentFilter) EnableSum(sumTypes ...SumType) ContentOption
func (*ContentFilter) GetDisplayItems ¶ added in v0.6.0
func (cf *ContentFilter) GetDisplayItems(e ...os.FileInfo) []*display.Item
func (*ContentFilter) SetNoOutputOptions ¶ added in v0.8.0
func (cf *ContentFilter) SetNoOutputOptions(outputFunc ...NoOutputOption)
func (*ContentFilter) SetOptions ¶ added in v0.4.0
func (cf *ContentFilter) SetOptions(options ...ContentOption)
func (*ContentFilter) SetSortFunc ¶ added in v0.5.0
func (cf *ContentFilter) SetSortFunc(sortFunc func(a, b os.FileInfo) bool)
type ContentFilterOption ¶ added in v0.8.0
type ContentFilterOption func(cf *ContentFilter)
func WithNoOutputOptions ¶ added in v0.8.0
func WithNoOutputOptions(options ...NoOutputOption) ContentFilterOption
func WithOptions ¶ added in v0.8.0
func WithOptions(options ...ContentOption) ContentFilterOption
type ContentOption ¶
type ItemFilter ¶ added in v0.8.0
type ItemFilter struct {
// contains filtered or unexported fields
}
func NewItemFilter ¶ added in v0.8.0
func NewItemFilter(tfs ...*ItemFilterFunc) *ItemFilter
func (*ItemFilter) AppendTo ¶ added in v0.8.0
func (tf *ItemFilter) AppendTo(typeFunc ...*ItemFilterFunc)
type ItemFilterFunc ¶ added in v0.8.0
ItemFilterFunc return true -> Keep return false -> remove
func ExtOnly ¶
func ExtOnly(ext ...string) ItemFilterFunc
func GlobOnly ¶ added in v0.5.0
func GlobOnly(globPattern ...string) (ItemFilterFunc, error)
GlobOnly if all pattern complied successfully, return a func and nil error, if match any one, the fn will return keep, else return remove if error occurred, return nil func and error
func MimeTypeOnly ¶ added in v0.8.0
func MimeTypeOnly(fileTypes ...string) ItemFilterFunc
func RemoveByExt ¶
func RemoveByExt(ext ...string) ItemFilterFunc
RemoveByExt
eg: a.go b.c c.rs d.cxx dir RemoveByExt([]string{"go", "cxx"}) result: b.c c.rs dir
func RemoveGitIgnore ¶ added in v0.4.1
func RemoveGitIgnore(repoPath git.GitRepoPath) ItemFilterFunc
func RemoveGlob ¶ added in v0.5.0
func RemoveGlob(globPattern ...string) (ItemFilterFunc, error)
RemoveGlob if all pattern complied successfully, return a func and nil error, if match any one, the fn will return remove, else return keep if error occurred, return nil func and error
func RemoveMimeType ¶ added in v0.8.0
func RemoveMimeType(fileTypes ...string) ItemFilterFunc
type LengthFixed ¶ added in v0.5.1
type LengthFixed interface { Done() Wait() Add(delta int) }
type NoOutputOption ¶ added in v0.8.0
Click to show internal directories.
Click to hide internal directories.