|
@@ -42,7 +42,7 @@ func version() string {
|
|
return version
|
|
return version
|
|
}
|
|
}
|
|
|
|
|
|
-// remove the extension from a given filename
|
|
|
|
|
|
+// remove the path and extension from a given filename
|
|
func basename(name string) string {
|
|
func basename(name string) string {
|
|
return filepath.Base(strings.TrimSuffix(name, filepath.Ext(name)))
|
|
return filepath.Base(strings.TrimSuffix(name, filepath.Ext(name)))
|
|
}
|
|
}
|
|
@@ -55,8 +55,6 @@ func main() {
|
|
// prepare staticmd with dependencies & defaults
|
|
// prepare staticmd with dependencies & defaults
|
|
staticmd := Staticmd{
|
|
staticmd := Staticmd{
|
|
Logger: log.Logger{Level: log.Error},
|
|
Logger: log.Logger{Level: log.Error},
|
|
- Subdirectories: make(map[string][]string),
|
|
|
|
- Indexes: make(map[string][]string),
|
|
|
|
Version: version(),
|
|
Version: version(),
|
|
Input: cwd,
|
|
Input: cwd,
|
|
Output: filepath.Join(cwd, "public/"),
|
|
Output: filepath.Join(cwd, "public/"),
|
|
@@ -83,6 +81,7 @@ func main() {
|
|
t, _ := maps.String(&flags, "", "template")
|
|
t, _ := maps.String(&flags, "", "template")
|
|
if tmpl, err := template.ParseFiles(t); err != nil {
|
|
if tmpl, err := template.ParseFiles(t); err != nil {
|
|
staticmd.Logger.Error("Failed to open template: %s", err)
|
|
staticmd.Logger.Error("Failed to open template: %s", err)
|
|
|
|
+ os.Exit(1)
|
|
} else {
|
|
} else {
|
|
staticmd.Template = *tmpl
|
|
staticmd.Template = *tmpl
|
|
}
|
|
}
|
|
@@ -114,6 +113,7 @@ func main() {
|
|
// print debug status
|
|
// print debug status
|
|
staticmd.Logger.Debug("Staticmd State: %+v", staticmd)
|
|
staticmd.Logger.Debug("Staticmd State: %+v", staticmd)
|
|
|
|
|
|
|
|
+ // walk the file system
|
|
if err := filepath.Walk(staticmd.Input, staticmd.Walk); err != nil {
|
|
if err := filepath.Walk(staticmd.Input, staticmd.Walk); err != nil {
|
|
staticmd.Logger.Error("failed to walk directory: %s", err)
|
|
staticmd.Logger.Error("failed to walk directory: %s", err)
|
|
}
|
|
}
|