1
0
mirror of https://github.com/danog/gojekyll.git synced 2025-01-23 10:21:12 +01:00
gojekyll/config/flags.go

27 lines
630 B
Go
Raw Normal View History

2017-07-01 15:03:36 -04:00
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 *string
Unpublished *bool
2017-07-01 15:13:32 -04:00
Drafts *bool
2017-07-01 15:03:36 -04:00
Future *bool
}
// ApplyFlags overwrites the configuration with values from flags.
func (c *Config) ApplyFlags(flags Flags) {
if flags.Destination != nil {
c.Destination = *flags.Destination
}
2017-07-01 15:13:32 -04:00
if flags.Drafts != nil {
c.Drafts = *flags.Drafts
}
2017-07-01 15:03:36 -04:00
if flags.Future != nil {
c.Future = *flags.Future
}
if flags.Unpublished != nil {
c.Unpublished = *flags.Unpublished
}
}