Documentation
¶
Index ¶
- Constants
- func Elide(str string, max int) string
- func FormatDuration(dur time.Duration) string
- func GetEnv(key, def string) string
- func Pad(str string, padding int) string
- func Pop(array []string) (string, []string)
- func Substr(input string, start int, length int) string
- type Filesystem
- func (fs *Filesystem) Exists() bool
- func (fs *Filesystem) IsDirectory() bool
- func (fs *Filesystem) IsExecutable() bool
- func (fs *Filesystem) IsFile() bool
- func (fs *Filesystem) IsGroupExecutable() bool
- func (fs *Filesystem) IsOtherExecutable() bool
- func (fs *Filesystem) IsOwnerExecutable() bool
- func (fs *Filesystem) Mode() os.FileMode
- func (fs *Filesystem) Name() string
- func (fs *Filesystem) Size() int64
Constants ¶
const ( // Suffix used to denote elided strings. ElideSuffix string = "..." // Length of the elide suffix. ElideSuffixLen int = 3 )
const ( // Character to use when padding strings. PadPadding string = " " )
Variables ¶
This section is empty.
Functions ¶
func FormatDuration ¶ added in v0.1.1
Format a time duration in pretty format.
Example, a duration of 72 minutes becomes "1 hour(s), 12 minute(s)".
func GetEnv ¶ added in v0.3.3
Look up the given key in the underlying operating system's environment and return its value.
Should the key not exist, then the given default value is returned instead.
Types ¶
type Filesystem ¶ added in v0.4.1
type Filesystem struct {
// contains filtered or unexported fields
}
Filesystem
Allow fort he checking of filesystem entities without having to open, stat, close continuously.
This is a wrapper around various methods from the `os` package that is designed to allow repeated querying without having to re-open and re-stat the entity.
If used within a struct, this will not provide any sort of live updates and it does not utilise `epoll` (or any other similar facility) to update if a file or directory structure changes.
Maybe one day it will facilitate live updates et al to track file changes, but that day is not today.
func NewFilesystem ¶ added in v0.4.1
func NewFilesystem(path string) *Filesystem
Create a new filesystem object.
func (*Filesystem) Exists ¶ added in v0.4.1
func (fs *Filesystem) Exists() bool
Does the entity exist?
func (*Filesystem) IsDirectory ¶ added in v0.4.1
func (fs *Filesystem) IsDirectory() bool
Is the entity a directory?
func (*Filesystem) IsExecutable ¶ added in v0.4.1
func (fs *Filesystem) IsExecutable() bool
Does the entity's permission bits include any type of "executable"?
func (*Filesystem) IsFile ¶ added in v0.4.1
func (fs *Filesystem) IsFile() bool
Is the entity a file?
func (*Filesystem) IsGroupExecutable ¶ added in v0.4.1
func (fs *Filesystem) IsGroupExecutable() bool
Does the entity's permission bits include "group executable"?
func (*Filesystem) IsOtherExecutable ¶ added in v0.4.1
func (fs *Filesystem) IsOtherExecutable() bool
Does the entity's permission bits include "other executable"?
func (*Filesystem) IsOwnerExecutable ¶ added in v0.4.1
func (fs *Filesystem) IsOwnerExecutable() bool
Does the entity's permission bits include "owner executable"?
func (*Filesystem) Mode ¶ added in v0.4.1
func (fs *Filesystem) Mode() os.FileMode
Return the entity's mode.
func (*Filesystem) Name ¶ added in v0.4.1
func (fs *Filesystem) Name() string
Return the entity's name.
func (*Filesystem) Size ¶ added in v0.4.1
func (fs *Filesystem) Size() int64
Return the entity's size.