I am going insane
This commit is contained in:
50
default/config/config.go
Normal file
50
default/config/config.go
Normal file
@@ -0,0 +1,50 @@
|
||||
package config
|
||||
|
||||
import "git.tebibyte.media/sashakoshka/tomo"
|
||||
|
||||
// Default specifies default configuration values.
|
||||
type Default struct { }
|
||||
|
||||
|
||||
// HandleWidth returns the default handle width value.
|
||||
func (Default) HandleWidth () int {
|
||||
return 15
|
||||
}
|
||||
|
||||
// ScrollVelocity returns the default scroll velocity value.
|
||||
func (Default) ScrollVelocity () int {
|
||||
return 16
|
||||
}
|
||||
|
||||
// ThemePath returns the default theme path.
|
||||
func (Default) ThemePath () (string) {
|
||||
return ""
|
||||
}
|
||||
|
||||
// Wrapped wraps a configuration and uses Default if it is nil.
|
||||
type Wrapped struct {
|
||||
tomo.Config
|
||||
}
|
||||
|
||||
// HandleWidth returns how large grab handles should typically be. This
|
||||
// is important for accessibility reasons.
|
||||
func (wrapped Wrapped) HandleWidth () int {
|
||||
return wrapped.ensure().HandleWidth()
|
||||
}
|
||||
|
||||
// ScrollVelocity returns how many pixels should be scrolled every time
|
||||
// a scroll button is pressed.
|
||||
func (wrapped Wrapped) ScrollVelocity () int {
|
||||
return wrapped.ensure().ScrollVelocity()
|
||||
}
|
||||
|
||||
// ThemePath returns the directory path to the theme.
|
||||
func (wrapped Wrapped) ThemePath () string {
|
||||
return wrapped.ensure().ThemePath()
|
||||
}
|
||||
|
||||
func (wrapped Wrapped) ensure () (real tomo.Config) {
|
||||
real = wrapped.Config
|
||||
if real == nil { real = Default { } }
|
||||
return
|
||||
}
|
||||
2
default/config/doc.go
Normal file
2
default/config/doc.go
Normal file
@@ -0,0 +1,2 @@
|
||||
// Package config implements a default configuration.
|
||||
package config
|
||||
9
default/config/parse.go
Normal file
9
default/config/parse.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
// import "io"
|
||||
|
||||
// Parse parses one or more configuration files and returns them as a Config.
|
||||
// func Parse (sources ...io.Reader) (config tomo.Config) {
|
||||
// // TODO
|
||||
// return Default { }
|
||||
// }
|
||||
Reference in New Issue
Block a user