From 9f9385e091a925ecf1d711daece1740138d12d59 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sun, 20 Oct 2024 20:42:28 +0200 Subject: Added README --- main.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 2dcec31..276654f 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,4 @@ -// wbr will run a build command and a run command on file system changes. This is so you can -// build&run on save. -// You specify a build command and run command as flags and optionally you can filter by extension. +// Run a command whenever a file is modified. package main @@ -29,8 +27,8 @@ var ( BuildCommand []string // Command run after build RunCommand []string - // Command will only run on files that have the Extensions extension - Extensions []string + // Command will only run on files that have the Suffixes extension + Suffixes []string // Layout for timestamp of command DateLayout string = "15:04:05" // Version tag for wbr @@ -50,7 +48,7 @@ func GetVersion() string { func CompileRun(fileName string) { found := false - for _, Ext := range Extensions { + for _, Ext := range Suffixes { if strings.HasSuffix(fileName, Ext) { found = true break @@ -130,9 +128,9 @@ func main() { } defer watcher.Close() - bc := flag.String("b", "", "Command to run for building") + bc := flag.String("b", "", "Command to run for building, it will pass the file modified as argument to it") rc := flag.String("r", "", "Command for running after build") - e := flag.String("e", "", "Filter watched files by suffix") + s := flag.String("s", "", "Filter watched files by suffix, specify multiple by separating with ','") p := flag.String("p", ".", "Path to watch for files") v := flag.Bool("v", false, "Show wbr version") flag.Parse() @@ -144,7 +142,7 @@ func main() { BuildCommand = strings.Split(*bc, " ") RunCommand = strings.Split(*rc, " ") - Extensions = strings.Split(*e, ",") + Suffixes = strings.Split(*s, ",") Path = *p fmt.Printf("[%s watching '%s'%s]\n", Cyan, Path, Reset) -- cgit v1.2.3