realize/settings/utils.go
2016-11-01 10:56:12 +01:00

28 lines
404 B
Go

package settings
import (
"log"
"os"
"path/filepath"
)
func (s Settings) Wdir() string {
dir, err := os.Getwd()
s.Validate(err)
return filepath.Base(dir)
}
func (s Settings) Validate(err error) error {
if err != nil {
s.Fatal("", err)
}
return nil
}
func (s Settings) Fatal(msg string, err error) {
if msg != "" {
log.Fatal(s.Red.Regular(msg), err.Error())
}
log.Fatal(err.Error())
}