Skip to content
Snippets Groups Projects
Verified Commit 55cb1ee5 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

feat: add exlude pattern

parent d1131462
No related branches found
No related tags found
No related merge requests found
......@@ -33,8 +33,13 @@ func SyncHtml(p string) error {
}
currentDir, _ := os.Getwd()
os.Chdir(filepath.Dir(p))
defer os.Chdir(currentDir)
if err := os.Chdir(filepath.Dir(p)); err != nil {
return err
}
defer func() {
_ = os.Chdir(currentDir)
}()
specification := types.SyncSpecification{}
......@@ -72,13 +77,13 @@ func SyncHtml(p string) error {
return err
}
fileinfo, err := os.Stat(d)
fileInfo, err := os.Stat(d)
if err != nil {
return err
}
if fileinfo.IsDir() {
filepath.Walk(d, func(pp string, info os.FileInfo, err error) error {
if fileInfo.IsDir() {
if err = filepath.Walk(d, func(pp string, info os.FileInfo, err error) error {
if err != nil {
return err
}
......@@ -112,7 +117,9 @@ func SyncHtml(p string) error {
}
return nil
})
}); err != nil {
return err
}
} else if filepath.Ext(d) == ".html" {
if exclude != nil {
......@@ -121,9 +128,17 @@ func SyncHtml(p string) error {
if err != nil {
return err
}
if e == d {
return nil
}
if r, err := filepath.Match(e, d); err != nil {
return err
} else if r {
return nil
}
}
}
......@@ -134,9 +149,7 @@ func SyncHtml(p string) error {
destinationFiles[d] = dd
destinationFile[absSource] = append(destinationFile[absSource], d)
}
}
for _, r := range specification.Sync {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment