github.com/wtfutil/wtf@v0.43.0/modules/mercurial/settings.go (about)

     1  package mercurial
     2  
     3  import (
     4  	"github.com/olebedev/config"
     5  	"github.com/wtfutil/wtf/cfg"
     6  )
     7  
     8  const (
     9  	defaultFocusable = true
    10  	defaultTitle     = "Mercurial"
    11  )
    12  
    13  type Settings struct {
    14  	*cfg.Common
    15  
    16  	commitCount  int           `help:"The number of past commits to display." optional:"true"`
    17  	commitFormat string        `help:"The string format for the commit message." optional:"true"`
    18  	repositories []interface{} `help:"Defines which mercurial repositories to watch." values:"A list of zero or more local file paths pointing to valid mercurial repositories."`
    19  }
    20  
    21  func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
    22  
    23  	settings := Settings{
    24  		Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
    25  
    26  		commitCount:  ymlConfig.UInt("commitCount", 10),
    27  		commitFormat: ymlConfig.UString("commitFormat", "[forestgreen]{rev}:{phase} [white]{desc|firstline|strip} [grey]{author|person} {date|age}[white]"),
    28  		repositories: ymlConfig.UList("repositories"),
    29  	}
    30  
    31  	return &settings
    32  }