oh-my-posh/segment_time.go

30 lines
568 B
Go
Raw Normal View History

2019-03-13 04:14:30 -07:00
package main
import (
"time"
)
type tempus struct {
props *properties
env environmentInfo
}
const (
// TimeFormat uses the reference time Mon Jan 2 15:04:05 MST 2006 to show the pattern with which to format the current time
2019-03-13 04:14:30 -07:00
TimeFormat Property = "time_format"
)
func (t *tempus) enabled() bool {
return true
}
func (t *tempus) string() string {
timeFormatProperty := t.props.getString(TimeFormat, "15:04:05")
return time.Now().Format(timeFormatProperty)
}
func (t *tempus) init(props *properties, env environmentInfo) {
t.props = props
t.env = env
}