Correct logic for checking when we're in stashed-only-mode

This commit is contained in:
Christian Rocha 2020-12-03 17:33:09 -05:00
parent e179741544
commit f680a9b96a
2 changed files with 14 additions and 2 deletions

View file

@ -137,11 +137,11 @@ type stashModel struct {
}
func (m stashModel) localOnly() bool {
return m.general.cfg.DocumentTypes.Equals(NewDocTypeSet(LocalDoc))
return m.general.cfg.localOnly()
}
func (m stashModel) stashedOnly() bool {
return m.general.cfg.DocumentTypes.Equals(NewDocTypeSet(StashedDoc))
return m.general.cfg.stashedOnly()
}
func (m stashModel) loadingDone() bool {

View file

@ -49,6 +49,18 @@ type Config struct {
GlamourEnabled bool `env:"GLOW_ENABLE_GLAMOUR" default:"true"`
}
func (c Config) showLocalFiles() bool {
return c.DocumentTypes.Contains(LocalDoc)
}
func (c Config) localOnly() bool {
return c.DocumentTypes.Equals(NewDocTypeSet(LocalDoc))
}
func (c Config) stashedOnly() bool {
return c.DocumentTypes.Contains(StashedDoc) && !c.DocumentTypes.Contains(NewsDoc)
}
// NewProgram returns a new Tea program.
func NewProgram(cfg Config) *tea.Program {
if cfg.Logfile != "" {