Documentation ¶
Overview ¶
Package ls implements formatting tools to list files like the Linux ls tool.
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 (FileInfo) PrintableName ¶
Name returns a printable file name.
type LongStringer ¶
LongStringer is a Stringer that returns the file info formatted in `ls -l` long format.
func (LongStringer) FileString ¶
func (ls LongStringer) FileString(fi FileInfo) string
FileString implements Stringer.FileString.
type NameStringer ¶
type NameStringer struct{}
NameStringer is a Stringer implementation that just prints the name.
func (NameStringer) FileString ¶
func (ns NameStringer) FileString(fi FileInfo) string
FileString implements Stringer.FileString and just returns fi's name.
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.