--- a/cmd/utils.go Sun May 07 19:30:24 2017 +0200
+++ b/cmd/utils.go Sun May 07 19:31:37 2017 +0200
@@ -95,6 +95,24 @@
return ioutil.ReadFile(name)
}
+func getThemes() ([]string, error) {
+ templDir := viper.GetString("template_directory")
+ if templDir == "" {
+ return nil, errors.New("template_directory not defined")
+ }
+ files, err := ioutil.ReadDir(filepath.Join(templDir, "themes"))
+ if err != nil {
+ return nil, errors.Wrap(err, "cannot read theme directory")
+ }
+ var tl []string
+ for _, f := range files {
+ if f.IsDir() {
+ tl = append(tl, f.Name())
+ }
+ }
+ return tl, nil
+}
+
func fileExists(filename string) bool {
if _, err := os.Stat(filename); err != nil {
return false