1
0
mirror of https://github.com/danog/gojekyll.git synced 2025-01-23 03:21:15 +01:00
gojekyll/config/flags.go
2017-07-07 15:28:51 -04:00

32 lines
758 B
Go

package config
// Flags are applied after the configuration file is loaded.
// They are pointers to represent optional types, to tell whether they have been set.
type Flags struct {
Destination, Host *string
Drafts, Future, Unpublished *bool
Port *int
}
// ApplyFlags overwrites the configuration with values from flags.
func (c *Config) ApplyFlags(flags Flags) {
if flags.Destination != nil {
c.Destination = *flags.Destination
}
if flags.Drafts != nil {
c.Drafts = *flags.Drafts
}
if flags.Future != nil {
c.Future = *flags.Future
}
if flags.Host != nil {
c.Host = *flags.Host
}
if flags.Port != nil {
c.Port = *flags.Port
}
if flags.Unpublished != nil {
c.Unpublished = *flags.Unpublished
}
}