diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-10-20 19:46:06 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-10-20 19:46:06 +0200 |
commit | 7021e4041bbfb469797f78572a9432f3c93b171f (patch) | |
tree | acdc504e865df8405c459d6fd31cca67791ac631 | |
parent | b3c154d89bd7b20df247b3c7e6c43dc10c12a4e9 (diff) |
Provide a list of extensions
-rw-r--r-- | main.go | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -40,14 +40,23 @@ var ( BuildCommand []string // Command run after build RunCommand []string - // Command will only run on files that have the Ext extension - Ext string + // Command will only run on files that have the Extensions extension + Extensions []string +) + const ( DateLayout string = "15:04:05" ) func CompileRun(fileName string) { - if !strings.HasSuffix(fileName, Ext) { + found := false + for _, Ext := range Extensions { + if strings.HasSuffix(fileName, Ext) { + found = true + break + } + } + if !found { return } @@ -129,7 +138,7 @@ func main() { BuildCommand = strings.Split(*bc, " ") RunCommand = strings.Split(*rc, " ") - Ext = *e + Extensions = strings.Split(*e, ",") Path = *p fmt.Printf("[%s watching '%s'%s]\n", Cyan, Path, Reset) |