realize/settings/utils.go
2016-12-16 23:53:27 +01:00

28 lines
422 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(err error, msg ...interface{}) {
if len(msg) > 0 {
log.Fatalln(s.Red.Regular(msg...), err.Error())
}
log.Fatalln(err.Error())
}