mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
WTF-482 More explicit param name in position.go
This commit is contained in:
parent
5a39bc00ce
commit
774c465f57
@ -21,7 +21,7 @@ type Position struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewPositionFromYAML creates and returns a new instance of Position
|
// NewPositionFromYAML creates and returns a new instance of Position
|
||||||
func NewPositionFromYAML(name string, moduleConfig *config.Config) Position {
|
func NewPositionFromYAML(moduleName string, moduleConfig *config.Config) Position {
|
||||||
errs := make(map[string]error)
|
errs := make(map[string]error)
|
||||||
|
|
||||||
// Parse the positional data from the config data
|
// Parse the positional data from the config data
|
||||||
@ -37,7 +37,7 @@ func NewPositionFromYAML(name string, moduleConfig *config.Config) Position {
|
|||||||
height, err := moduleConfig.Int(positionPath + ".height")
|
height, err := moduleConfig.Int(positionPath + ".height")
|
||||||
errs["height"] = err
|
errs["height"] = err
|
||||||
|
|
||||||
validatePositions(name, errs)
|
validatePositions(moduleName, errs)
|
||||||
|
|
||||||
pos := Position{
|
pos := Position{
|
||||||
Top: top,
|
Top: top,
|
||||||
@ -71,7 +71,7 @@ func NewPositionFromYAML(name string, moduleConfig *config.Config) Position {
|
|||||||
// width: 2
|
// width: 2
|
||||||
// height: 1
|
// height: 1
|
||||||
//
|
//
|
||||||
func validatePositions(name string, errs map[string]error) {
|
func validatePositions(moduleName string, errs map[string]error) {
|
||||||
var errStr string
|
var errStr string
|
||||||
|
|
||||||
for pos, err := range errs {
|
for pos, err := range errs {
|
||||||
@ -82,7 +82,7 @@ func validatePositions(name string, errs map[string]error) {
|
|||||||
|
|
||||||
if errStr != "" {
|
if errStr != "" {
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
fmt.Printf("\033[0;31mErrors in %s configuration\033[0m\n", strings.Title(name))
|
fmt.Printf("\033[0;31mErrors in %s configuration\033[0m\n", strings.Title(moduleName))
|
||||||
fmt.Println(errStr)
|
fmt.Println(errStr)
|
||||||
fmt.Println("Please check your config.yml file.")
|
fmt.Println("Please check your config.yml file.")
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user