You've already forked filebrowser
mirror of
https://github.com/filebrowser/filebrowser.git
synced 2025-11-26 14:25:26 +08:00
close #47
This commit is contained in:
@@ -164,9 +164,20 @@ func ParseComponents(r *http.Request) []string {
|
||||
}
|
||||
|
||||
// Run is used to run the static website generator
|
||||
func Run(c *config.Config) {
|
||||
func Run(c *config.Config, force bool) {
|
||||
os.RemoveAll(c.Path + "public")
|
||||
|
||||
// Prevent running if watching is enabled
|
||||
if b, pos := stringInSlice("--watch", c.Args); b && !force {
|
||||
if len(c.Args) > pos && c.Args[pos+1] != "false" {
|
||||
return
|
||||
}
|
||||
|
||||
if len(c.Args) == pos+1 {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if err := RunCommand("hugo", c.Args, c.Path); err != nil {
|
||||
log.Panic(err)
|
||||
}
|
||||
@@ -181,6 +192,15 @@ func RunCommand(command string, args []string, path string) error {
|
||||
return cmd.Run()
|
||||
}
|
||||
|
||||
func stringInSlice(a string, list []string) (bool, int) {
|
||||
for i, b := range list {
|
||||
if b == a {
|
||||
return true, i
|
||||
}
|
||||
}
|
||||
return false, 0
|
||||
}
|
||||
|
||||
var splitCapitalizeExceptions = map[string]string{
|
||||
"youtube": "YouTube",
|
||||
"github": "GitHub",
|
||||
|
||||
Reference in New Issue
Block a user