moth/cmd/mothd/theme.go

34 lines
534 B
Go
Raw Normal View History

2019-09-02 18:42:27 -06:00
package main
import (
2019-12-05 22:25:03 -07:00
"github.com/spf13/afero"
"time"
2019-09-02 18:42:27 -06:00
)
type Theme struct {
afero.Fs
2019-09-02 18:42:27 -06:00
}
2019-12-05 22:25:03 -07:00
func NewTheme(fs afero.Fs) *Theme {
2019-09-02 18:42:27 -06:00
return &Theme{
Fs: fs,
2019-09-02 18:42:27 -06:00
}
}
// I don't understand why I need this. The type checking system is weird here.
func (t *Theme) Open(name string) (ReadSeekCloser, error) {
return t.Fs.Open(name)
}
2019-09-02 18:42:27 -06:00
func (t *Theme) ModTime(name string) (mt time.Time, err error) {
fi, err := t.Fs.Stat(name)
if err == nil {
mt = fi.ModTime()
2019-09-02 18:42:27 -06:00
}
return
}
2019-09-02 18:42:27 -06:00
func (t *Theme) Update() {
// No periodic tasks for a theme
2019-09-02 18:42:27 -06:00
}