1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00
wtf/modules/textfile/settings.go

31 lines
640 B
Go

package textfile
import (
"github.com/olebedev/config"
"github.com/wtfutil/wtf/cfg"
)
const configKey = "textfile"
type Settings struct {
common *cfg.Common
filePaths []interface{}
format bool
formatStyle string
}
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
settings := Settings{
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
filePaths: localConfig.UList("filePaths"),
format: localConfig.UBool("format", false),
formatStyle: localConfig.UString("formatStyle", "vim"),
}
return &settings
}