diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-08-14 21:21:39 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-08-14 21:21:39 +0200 |
commit | e5052f4e09b6df590cddf2f8bc2c834fd3af3082 (patch) | |
tree | 90e78f8bb54a4c7da217c639369afbc4486c54b6 /commands | |
parent | c81fbf4625ae7cc7dd3a7a526331ddfdf5237cc6 (diff) |
commands: Include theme name in version mismatch error
Fixes #5044
Diffstat (limited to 'commands')
-rw-r--r-- | commands/commandeer.go | 8 | ||||
-rw-r--r-- | commands/hugo.go | 4 |
2 files changed, 7 insertions, 5 deletions
diff --git a/commands/commandeer.go b/commands/commandeer.go index 3ff0b6426..0a024f047 100644 --- a/commands/commandeer.go +++ b/commands/commandeer.go @@ -17,6 +17,7 @@ import ( "os" "path/filepath" "regexp" + "strings" "sync" "time" @@ -324,11 +325,12 @@ func (c *commandeer) loadConfig(mustHaveConfigFile, running bool) error { } } - themeVersionMismatch, minVersion := c.isThemeVsHugoVersionMismatch(sourceFs) + dir, themeVersionMismatch, minVersion := c.isThemeVsHugoVersionMismatch(sourceFs) if themeVersionMismatch { - cfg.Logger.ERROR.Printf("Current theme does not support Hugo version %s. Minimum version required is %s\n", - helpers.CurrentHugoVersion.ReleaseVersion(), minVersion) + name := filepath.Base(dir) + cfg.Logger.ERROR.Printf("%s theme does not support Hugo version %s. Minimum version required is %s\n", + strings.ToUpper(name), helpers.CurrentHugoVersion.ReleaseVersion(), minVersion) } return nil diff --git a/commands/hugo.go b/commands/hugo.go index 1381bf210..c80080c49 100644 --- a/commands/hugo.go +++ b/commands/hugo.go @@ -945,7 +945,7 @@ func pickOneWriteOrCreatePath(events []fsnotify.Event) string { // isThemeVsHugoVersionMismatch returns whether the current Hugo version is // less than any of the themes' min_version. -func (c *commandeer) isThemeVsHugoVersionMismatch(fs afero.Fs) (mismatch bool, requiredMinVersion string) { +func (c *commandeer) isThemeVsHugoVersionMismatch(fs afero.Fs) (dir string, mismatch bool, requiredMinVersion string) { if !c.hugo.PathSpec.ThemeSet() { return } @@ -970,7 +970,7 @@ func (c *commandeer) isThemeVsHugoVersionMismatch(fs afero.Fs) (mismatch bool, r if minVersion, ok := tomlMeta["min_version"]; ok { if helpers.CompareVersion(minVersion) > 0 { - return true, fmt.Sprint(minVersion) + return absThemeDir, true, fmt.Sprint(minVersion) } } |