Parse config overrides on cli

This commit is contained in:
Dan Jones 2024-02-09 09:44:35 -06:00
commit 25f5c37243
8 changed files with 169 additions and 32 deletions

View file

@ -1,8 +1,10 @@
package config
import mapst "github.com/mitchellh/mapstructure"
type Config struct {
Input Input
Outputs map[string]Output `toml:"output"`
Outputs Outputs `toml:"output"`
}
type Input struct {
@ -11,7 +13,23 @@ type Input struct {
Ext string
}
type Outputs map[string]Output
type Output struct {
Enabled bool
Config map[string]any
}
func (oo Outputs) Stdout() (s Stdout, enabled bool) {
o, ok := oo["stdout"]
if !ok {
return s, false
}
enabled = o.Enabled
mapst.Decode(o.Config, &s)
return
}
type Stdout struct {
Json bool
}