diff options
| -rw-r--r-- | main.go | 16 | 
1 files changed, 10 insertions, 6 deletions
| @@ -13,6 +13,7 @@ import (  	"fmt"  	"os/exec"  	"strings" +	"time"  	"github.com/fsnotify/fsnotify"  ) @@ -41,6 +42,8 @@ var (  	RunCommand []string  	// Command will only run on files that have the Ext extension  	Ext string +const ( +	DateLayout string = "15:04:05"  )  func CompileRun(fileName string) { @@ -59,13 +62,13 @@ func CompileRun(fileName string) {  		// run the build command  		out, err := buildCmd.CombinedOutput() +		date := time.Now().Format(DateLayout)  		if len(BuildCommand) > 1 { -			fmt.Printf("[%s%s %s%s]\n", Cyan, BuildCommand[0], strings.Join(append(BuildCommand[1:], fileName), " "), Reset) +			fmt.Printf("[%s %s%s %s%s]\n", date, Cyan, BuildCommand[0], strings.Join(append(BuildCommand[1:], fileName), " "), Reset)  		} else { -			fmt.Printf("[%s%s %s %s%s]\n", Cyan, BuildCommand[0], BuildCommand, fileName, Reset) +			fmt.Printf("[%s %s%s %s %s%s]\n", date, Cyan, BuildCommand[0], BuildCommand, fileName, Reset)  		} -		fmt.Println(len(BuildCommand))  		if len(out) > 0 {  			fmt.Printf("%s", out)  		} @@ -88,11 +91,12 @@ func CompileRun(fileName string) {  			runCmd = exec.Command(RunCommand[0])  		} +		date := time.Now().Format(DateLayout)  		out, err := runCmd.CombinedOutput()  		if len(RunCommand) > 1 { -			fmt.Printf("[%s%s %s%s]\n", Cyan, RunCommand[0], strings.Join(RunCommand[1:], " "), Reset) +			fmt.Printf("[%s %s%s %s%s]\n", date, Cyan, RunCommand[0], strings.Join(RunCommand[1:], " "), Reset)  		} else { -			fmt.Printf("[%s%s%s]\n", Cyan, RunCommand[0], Reset) +			fmt.Printf("[%s %s%s%s]\n", date, Cyan, RunCommand[0], Reset)  		}  		if len(out) > 0 { @@ -128,7 +132,7 @@ func main() {  	Ext = *e  	Path = *p -	fmt.Printf("[%swbr%s:%s watching '%s'%s]\n", BoldCyan, Reset, Cyan, Path, Reset) +	fmt.Printf("[%s watching '%s'%s]\n", Cyan, Path, Reset)  	go func() {  		for { | 
