ls

package
v11.0.0-...-c252e5c Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2018 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileInfo

type FileInfo struct {
	Name          string
	Mode          os.FileMode
	Rdev          uint64
	UID, GID      uint32
	Size          int64
	MTime         time.Time
	SymlinkTarget string
}

Since `os.FileInfo` is an interface, it is difficult to tweak some of its internal values. For example, replacing the starting directory with a dot. `extractImportantParts` populates our own struct which we can modify at will before printing.

func FromOSFileInfo

func FromOSFileInfo(path string, fi os.FileInfo) FileInfo

func (FileInfo) PrintableName

func (fi FileInfo) PrintableName() string

Name returns a printable file name.

type LongStringer

type LongStringer struct {
	Human bool
	Name  Stringer
}

func (LongStringer) FileString

func (ls LongStringer) FileString(fi FileInfo) string

type NameStringer

type NameStringer struct{}

func (NameStringer) FileString

func (ns NameStringer) FileString(fi FileInfo) string

type QuotedStringer

type QuotedStringer struct{}

QuotedStringer is a Stringer that returns the file name surrounded by qutoes with escaped control characters.

func (QuotedStringer) FileString

func (qs QuotedStringer) FileString(fi FileInfo) string

FileString returns the name surrounded by quotes with escaped control characters.

type Stringer

type Stringer interface {
	FileString(fi FileInfo) string
}

Jump to

Keyboard shortcuts

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