Documentation ¶
Index ¶
Constants ¶
const DefaultWeatherFormat = "1"
DefaultWeatherFormat is the default wttr.in weather format. See https://github.com/chubin/wttr.in#one-line-output for more details
Variables ¶
var ErrHelperNotFound = fmt.Errorf("helper not found")
ErrHelperNotFound means no helper exists by the specified name
Functions ¶
Types ¶
type BashHelper ¶
type BashHelper struct { }
BashHelper runs a bash command and displays the output
func (*BashHelper) Run ¶
func (h *BashHelper) Run(config string) string
Run runs a bash command and displays the output
func (*BashHelper) UpdateInterval ¶
func (h *BashHelper) UpdateInterval() time.Duration
UpdateInterval returns the minimum time period before the helper should run again
type BatteryHelper ¶
type BatteryHelper struct { }
BatteryHelper shows the current battery charge level as a percentage
func (*BatteryHelper) Run ¶
func (h *BatteryHelper) Run(config string) string
Run returns the current battery charge level as a percentage
func (*BatteryHelper) UpdateInterval ¶
func (h *BatteryHelper) UpdateInterval() time.Duration
UpdateInterval returns the minimum time period before the helper should run again
type CPUHelper ¶
type CPUHelper struct { }
CPUHelper shows the current cpu usage as a percentage
func (*CPUHelper) UpdateInterval ¶
UpdateInterval returns the minimum time period before the helper should run again
type Helper ¶
type Helper interface { Run(config string) string // Run starts the helper and returns the output UpdateInterval() time.Duration // UpdateInterval returns the minimum time period before the helper should run again }
Helper is a dynamic operation which creates output for the status bar
type HelperRun ¶ added in v0.0.18
type HelperRun struct {
// contains filtered or unexported fields
}
HelperRun represents a single run of a helper
type HelperRunCache ¶ added in v0.0.18
type HelperRunCache struct {
// contains filtered or unexported fields
}
HelperRunCache stores the last run of all unique helpers. A helper is defined by its name and config
func NewHelperRunCache ¶ added in v0.0.18
func NewHelperRunCache() HelperRunCache
NewHelperRunCache creates a new helper run cache
func (*HelperRunCache) GetOrAdd ¶ added in v0.0.18
func (c *HelperRunCache) GetOrAdd(key string) HelperRun
GetOrAdd tries to find an item in the cache and creates one if not found
func (*HelperRunCache) Key ¶ added in v0.0.18
func (c *HelperRunCache) Key(parts ...string) string
Key generates a cache key from a Helper's attributes
func (*HelperRunCache) Put ¶ added in v0.0.18
func (c *HelperRunCache) Put(key, output string)
Put updates an existing item in the cache or creates one if not found
type MemoryHelper ¶
type MemoryHelper struct { }
MemoryHelper shows the current memory usage as a percentage
func (*MemoryHelper) Run ¶
func (h *MemoryHelper) Run(config string) string
Run returns the current memory usage as a percentage
func (*MemoryHelper) UpdateInterval ¶
func (h *MemoryHelper) UpdateInterval() time.Duration
UpdateInterval returns the minimum time period before the helper should run again
type TimeHelper ¶
type TimeHelper struct { }
TimeHelper shows the current time
func (*TimeHelper) Run ¶
func (h *TimeHelper) Run(config string) string
Run returns the current time
func (*TimeHelper) UpdateInterval ¶
func (h *TimeHelper) UpdateInterval() time.Duration
UpdateInterval returns the minimum time period before the helper should run again
type UntilHelper ¶ added in v0.0.18
type UntilHelper struct { }
TimeHelper shows the current time
func (*UntilHelper) Run ¶ added in v0.0.18
func (h *UntilHelper) Run(config string) string
Run returns the current time
func (*UntilHelper) UpdateInterval ¶ added in v0.0.18
func (h *UntilHelper) UpdateInterval() time.Duration
UpdateInterval returns the minimum time period before the helper should run again
type WeatherHelper ¶
type WeatherHelper struct { }
WeatherHelper shows the current weather
func (*WeatherHelper) Run ¶
func (h *WeatherHelper) Run(config string) string
Run returns the current weather
func (*WeatherHelper) UpdateInterval ¶
func (h *WeatherHelper) UpdateInterval() time.Duration
UpdateInterval returns the minimum time period before the helper should run again