realize/settings/utils.go

28 lines
404 B
Go
Raw Normal View History

2016-11-01 09:56:12 +00:00
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())
}