From: Cameron Moore Date: Fri, 23 Dec 2016 04:44:35 +0000 (-0600) Subject: helpers: Remove "no theme set" warning X-Git-Tag: v0.19~182 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=8b0c3b9b271c7f3eaa812f7a98bb738fe9cc1846;p=brevno-suite%2Fhugo helpers: Remove "no theme set" warning Fixes #2821 --- diff --git a/commands/hugo.go b/commands/hugo.go index 153980cb..32846f87 100644 --- a/commands/hugo.go +++ b/commands/hugo.go @@ -472,7 +472,9 @@ func getStaticSourceFs() afero.Fs { useStatic := true if err != nil { - jww.WARN.Println(err) + if err != helpers.ErrThemeUndefined { + jww.WARN.Println(err) + } useTheme = false } else { if _, err := source.Stat(themeDir); os.IsNotExist(err) { diff --git a/helpers/path.go b/helpers/path.go index 7dea0b0d..6e2422d0 100644 --- a/helpers/path.go +++ b/helpers/path.go @@ -31,6 +31,13 @@ import ( "golang.org/x/text/unicode/norm" ) +var ( + // ErrThemeUndefined is returned when a theme has not be defined by the user. + ErrThemeUndefined = errors.New("no theme set") + + ErrWalkRootTooShort = errors.New("Path too short. Stop walking.") +) + // filepathPathBridge is a bridge for common functionality in filepath vs path type filepathPathBridge interface { Base(in string) string @@ -207,7 +214,7 @@ func GetThemeI18nDirPath() (string, error) { func getThemeDirPath(path string) (string, error) { if !ThemeSet() { - return "", errors.New("No theme set") + return "", ErrThemeUndefined } themeDir := filepath.Join(GetThemeDir(), path) @@ -485,8 +492,6 @@ func FindCWD() (string, error) { return path, nil } -var ErrWalkRootTooShort = errors.New("Path too short. Stop walking.") - // SymbolicWalk is like filepath.Walk, but it supports the root being a // symbolic link. It will still not follow symbolic links deeper down in // the file structure