aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2024-10-20 19:46:06 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2024-10-20 19:46:06 +0200
commit7021e4041bbfb469797f78572a9432f3c93b171f (patch)
treeacdc504e865df8405c459d6fd31cca67791ac631
parentb3c154d89bd7b20df247b3c7e6c43dc10c12a4e9 (diff)
Provide a list of extensions
-rw-r--r--main.go17
1 files changed, 13 insertions, 4 deletions
diff --git a/main.go b/main.go
index a783bef..0888e93 100644
--- a/main.go
+++ b/main.go
@@ -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)