mirror of
https://github.com/taigrr/wtf
synced 2026-03-21 14:12:17 -07:00
WTF-400 CmdRunner extracted to new config format
This commit is contained in:
27
modules/cmdrunner/settings.go
Normal file
27
modules/cmdrunner/settings.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package cmdrunner
|
||||
|
||||
import (
|
||||
"github.com/olebedev/config"
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
"github.com/wtfutil/wtf/wtf"
|
||||
)
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
args []string
|
||||
cmd string
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.cmdrunner")
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
|
||||
args: wtf.ToStrs(wtf.Config.UList("args")),
|
||||
cmd: localConfig.UString("cmd"),
|
||||
}
|
||||
|
||||
return &settings
|
||||
}
|
||||
Reference in New Issue
Block a user