mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
31 lines
640 B
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
|
|
}
|