content

package
v0.27.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2024 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GitRepoBranch = constval.NameOfGitRepoBranch
	GitRepoStatus = constval.NameOfGitRepoStatus
)
View Source
const (
	GroupName    = constval.NameOfGroupName
	GroupUidName = constval.NameOfGroupUidName
	GroupSID     = constval.NameOfGroupSID
)
View Source
const (
	MimeTypeName       = constval.NameOfMIME
	ParentMimeTypeName = "Parent-Mime-type"
)
View Source
const (
	OwnerName    = constval.NameOfOwner
	OwnerUidName = constval.NameOfOwnerUid
	OwnerSID     = constval.NameOfOwnerSID
)
View Source
const (
	KB = 1000 * Byte
	MB = 1000 * KB
	GB = 1000 * MB
	TB = 1000 * GB
)

SI units

View Source
const BlockSizeName = "Blocks"
View Source
const (
	Charset = constval.NameOfCharset
)
View Source
const NameName = constval.NameOfName
View Source
const OctalPermissions = "Octal"
View Source
const Permissions = constval.NameOfPermission
View Source
const RecursiveSizeName = "recursive_size"
View Source
const RelativeTime = constval.NameOfRelativeTime
View Source
const SizeName = constval.NameOfSize

Variables

View Source
var Pool *ants.Pool

Functions

func Convert2SizeString

func Convert2SizeString(size SizeUnit) string

func CountBytes

func CountBytes(size SizeUnit) uint64

func DetectorFallthrough

func DetectorFallthrough(d *DuplicateDetect)

func MountsOn

func MountsOn(path string) string

Types

type BlockSizeEnabler

type BlockSizeEnabler struct{}

func NewBlockSizeEnabler

func NewBlockSizeEnabler() *BlockSizeEnabler

func (*BlockSizeEnabler) Enable

func (b *BlockSizeEnabler) Enable(renderer *render.Renderer) ContentOption

type CharsetEnabler

type CharsetEnabler struct{}

func NewCharsetEnabler

func NewCharsetEnabler() *CharsetEnabler

func (*CharsetEnabler) Enable

func (c *CharsetEnabler) Enable(renderer *render.Renderer) ContentOption

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) AppendToNoOutputOptions

func (cf *ContentFilter) AppendToNoOutputOptions(options ...NoOutputOption)

func (*ContentFilter) AppendToOptions

func (cf *ContentFilter) AppendToOptions(options ...ContentOption)

func (*ContentFilter) GetDisplayItems

func (cf *ContentFilter) GetDisplayItems(e *[]*item.FileInfo)

func (*ContentFilter) SetNoOutputOptions

func (cf *ContentFilter) SetNoOutputOptions(outputFunc ...NoOutputOption)

func (*ContentFilter) SetOptions

func (cf *ContentFilter) SetOptions(options ...ContentOption)

func (*ContentFilter) SetSortFunc

func (cf *ContentFilter) SetSortFunc(sortFunc func(a, b *item.FileInfo) int)

func (*ContentFilter) SortFunc

func (cf *ContentFilter) SortFunc() func(a, b *item.FileInfo) int

type ContentFilterOption

type ContentFilterOption func(cf *ContentFilter)

func WithNoOutputOptions

func WithNoOutputOptions(options ...NoOutputOption) ContentFilterOption

func WithOptions

func WithOptions(options ...ContentOption) ContentFilterOption

type ContentOption

type ContentOption func(info *item.FileInfo) (stringContent string, funcName string)

func EnableFileMode

func EnableFileMode(renderer *render.Renderer) ContentOption

EnableFileMode return file mode like -rwxrwxrwx/drwxrwxrwx

func EnableFileOctalPermissions

func EnableFileOctalPermissions(renderer *render.Renderer) ContentOption

func EnableTime

func EnableTime(format string, mode string, renderer *render.Renderer) ContentOption

EnableTime enables time accepts ['mod', 'modified', 'create', 'access', 'birth']

type DOption

type DOption func(d *DuplicateDetect)

func DuplicateWithTbSize

func DuplicateWithTbSize(size int) DOption

type Duplicate

type Duplicate struct {
	Filenames []string
}

type DuplicateDetect

type DuplicateDetect struct {
	IsThrough bool
	// contains filtered or unexported fields
}

func NewDuplicateDetect

func NewDuplicateDetect(options ...DOption) *DuplicateDetect

func (*DuplicateDetect) Enable

func (d *DuplicateDetect) Enable() NoOutputOption

func (*DuplicateDetect) Fprint

func (d *DuplicateDetect) Fprint(w io.Writer)

func (*DuplicateDetect) Reset

func (d *DuplicateDetect) Reset()

func (*DuplicateDetect) Result

func (d *DuplicateDetect) Result() []Duplicate

type GitEnabler

type GitEnabler struct {
	Path git.RepoPath
	// contains filtered or unexported fields
}

func NewGitEnabler

func NewGitEnabler() *GitEnabler

func (*GitEnabler) Enable

func (g *GitEnabler) Enable(renderer *render.Renderer) ContentOption

func (*GitEnabler) InitCache

func (g *GitEnabler) InitCache(repo git.RepoPath)

type GitRepoEnabler

type GitRepoEnabler struct{}

func NewGitRepoEnabler

func NewGitRepoEnabler() *GitRepoEnabler

func (*GitRepoEnabler) Enable

func (g *GitRepoEnabler) Enable(renderer *render.Renderer) ContentOption

func (*GitRepoEnabler) EnableStatus

func (g *GitRepoEnabler) EnableStatus(renderer *render.Renderer) ContentOption

type GroupEnabler

type GroupEnabler struct {
	Numeric bool
	Smart   bool
}

func NewGroupEnabler

func NewGroupEnabler() *GroupEnabler

func (*GroupEnabler) DisableNumeric

func (g *GroupEnabler) DisableNumeric()

func (*GroupEnabler) DisableSmartMode

func (g *GroupEnabler) DisableSmartMode()

func (*GroupEnabler) EnableGroup

func (g *GroupEnabler) EnableGroup(renderer *render.Renderer) ContentOption

func (*GroupEnabler) EnableNumeric

func (g *GroupEnabler) EnableNumeric()

func (*GroupEnabler) EnableSmartMode

func (g *GroupEnabler) EnableSmartMode()

type IndexEnabler

type IndexEnabler struct{}

func NewIndexEnabler

func NewIndexEnabler() *IndexEnabler

func (*IndexEnabler) Enable

func (i *IndexEnabler) Enable() ContentOption

type InodeEnabler

type InodeEnabler struct{}

func NewInodeEnabler

func NewInodeEnabler() *InodeEnabler

func (*InodeEnabler) Enable

func (i *InodeEnabler) Enable(renderer *render.Renderer) ContentOption

type LinkEnabler

type LinkEnabler struct{}

LinkEnabler List each file's number of hard links.

func NewLinkEnabler

func NewLinkEnabler() *LinkEnabler

func (*LinkEnabler) Enable

func (l *LinkEnabler) Enable(renderer *render.Renderer) ContentOption

type MimeFileTypeEnabler

type MimeFileTypeEnabler struct {
	ParentOnly bool
}

func NewMimeFileTypeEnabler

func NewMimeFileTypeEnabler() *MimeFileTypeEnabler

func (*MimeFileTypeEnabler) Enable

func (e *MimeFileTypeEnabler) Enable(renderer *render.Renderer) ContentOption

type Name

type Name struct {
	Quote       string
	QuoteStatus int8 // >1 always quote || =0 default || <0 never quote
	// contains filtered or unexported fields
}

func NewNameEnable

func NewNameEnable() *Name

func (*Name) Enable

func (n *Name) Enable(renderer *render.Renderer) ContentOption

Enable color + icon + file://quote+filename/relative-name+quote + classify + color-end + dereference + mounts color: filetype->filename->fileext->file

func (*Name) FullPath

func (n *Name) FullPath() bool

func (*Name) RelativeTo

func (n *Name) RelativeTo() string

func (*Name) SetClassify

func (n *Name) SetClassify() *Name

func (*Name) SetFileType

func (n *Name) SetFileType() *Name

SetFileType set file type should set classify first if classify is false, fileType will be ignored

func (*Name) SetFullPath

func (n *Name) SetFullPath() *Name
func (n *Name) SetHyperlink() *Name

func (*Name) SetIcon

func (n *Name) SetIcon() *Name

func (*Name) SetJson

func (n *Name) SetJson() *Name

func (*Name) SetMounts

func (n *Name) SetMounts() *Name

func (*Name) SetNoDeference

func (n *Name) SetNoDeference() *Name

func (*Name) SetQuote

func (n *Name) SetQuote() *Name

func (*Name) SetQuoteString

func (n *Name) SetQuoteString(quote string) *Name

func (*Name) SetRelativeTo

func (n *Name) SetRelativeTo(relativeTo string)

func (*Name) SetStatistics

func (n *Name) SetStatistics(Statistics *Statistics) *Name

func (*Name) Statistics

func (n *Name) Statistics() *Statistics

func (*Name) UnsetClassify

func (n *Name) UnsetClassify() *Name

func (*Name) UnsetFileType

func (n *Name) UnsetFileType() *Name

func (*Name) UnsetFullPath

func (n *Name) UnsetFullPath() *Name
func (n *Name) UnsetHyperlink() *Name

func (*Name) UnsetIcon

func (n *Name) UnsetIcon() *Name

func (*Name) UnsetJson

func (n *Name) UnsetJson() *Name

func (*Name) UnsetMounts

func (n *Name) UnsetMounts() *Name

func (*Name) UnsetNoDeference

func (n *Name) UnsetNoDeference() *Name

func (*Name) UnsetQuote

func (n *Name) UnsetQuote() *Name

type NoOutputOption

type NoOutputOption func(info *item.FileInfo)

type OwnerEnabler

type OwnerEnabler struct {
	Numeric bool
}

func NewOwnerEnabler

func NewOwnerEnabler() *OwnerEnabler

func (*OwnerEnabler) DisableNumeric

func (o *OwnerEnabler) DisableNumeric()

func (*OwnerEnabler) EnableNumeric

func (o *OwnerEnabler) EnableNumeric()

func (*OwnerEnabler) EnableOwner

func (o *OwnerEnabler) EnableOwner(renderer *render.Renderer) ContentOption

type RelativeTimeEnabler

type RelativeTimeEnabler struct {
	Mode string
}

func NewRelativeTimeEnabler

func NewRelativeTimeEnabler() *RelativeTimeEnabler

func (*RelativeTimeEnabler) Enable

func (r *RelativeTimeEnabler) Enable(renderer *render.Renderer) ContentOption

type Size

type Size struct {
	Bytes uint64
}

func ParseSize

func ParseSize(size string) (Size, error)

type SizeEnabler

type SizeEnabler struct {
	// contains filtered or unexported fields
}

func NewSizeEnabler

func NewSizeEnabler() *SizeEnabler

func (*SizeEnabler) DisableTotal

func (s *SizeEnabler) DisableTotal()

func (*SizeEnabler) EnableSize

func (s *SizeEnabler) EnableSize(size SizeUnit, renderer *render.Renderer) ContentOption

func (*SizeEnabler) Recursive

func (s *SizeEnabler) Recursive() *SizeRecursive

func (*SizeEnabler) Reset

func (s *SizeEnabler) Reset()

func (*SizeEnabler) SetEnableTotal

func (s *SizeEnabler) SetEnableTotal()

func (*SizeEnabler) SetRecursive

func (s *SizeEnabler) SetRecursive(sr *SizeRecursive)

func (*SizeEnabler) SetSI

func (s *SizeEnabler) SetSI() *SizeEnabler

func (*SizeEnabler) Size2String

func (s *SizeEnabler) Size2String(b int64) (string, SizeUnit)

func (*SizeEnabler) SizeUint

func (s *SizeEnabler) SizeUint() SizeUnit

func (*SizeEnabler) Total

func (s *SizeEnabler) Total() (size int64, ok bool)

type SizeRecursive

type SizeRecursive struct {
	// contains filtered or unexported fields
}

func NewSizeRecursive

func NewSizeRecursive(depth int) *SizeRecursive

type SizeUnit

type SizeUnit float64
const (
	Auto SizeUnit = iota
	Bit  SizeUnit = 1.0 << (10 * iota)
	Byte
	KiB
	MiB
	GiB
	TiB
)
const Unknown SizeUnit = -1

func ConvertFromSizeString

func ConvertFromSizeString(size string, isSI bool) SizeUnit

type Statistics

type Statistics struct {
	// contains filtered or unexported fields
}

func (*Statistics) MarshalJSON

func (s *Statistics) MarshalJSON() ([]byte, error)

func (*Statistics) Reset

func (s *Statistics) Reset()

func (*Statistics) String

func (s *Statistics) String() string

type SumEnabler

type SumEnabler struct{}

func (SumEnabler) EnableSum

func (s SumEnabler) EnableSum(renderer *render.Renderer, sumTypes ...SumType) []ContentOption

type SumType

type SumType string
const (
	SumTypeMd5    SumType = "MD5"
	SumTypeSha1   SumType = "SHA1"
	SumTypeSha224 SumType = "SHA224"
	SumTypeSha256 SumType = "SHA256"
	SumTypeSha384 SumType = "SHA384"
	SumTypeSha512 SumType = "SHA512"
	SumTypeCRC32  SumType = "CRC32"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL