feat: set default program to `go run .`
1 file changed, 10 insertions(+), 2 deletions(-)
changed files
M main.go → main.go
@@ -6,6 +6,7 @@ "flag" "log" "os" "os/signal" + "slices" "strings" "sync" "syscall"@@ -102,8 +103,15 @@ log.SetFlags(log.Lmsgprefix) flag.Parse() program := *Exec + args := flag.Args() if program == "" { - log.Fatal("no command provided") + program = "go" + + if len(args) == 0 { + args = []string{"run", "."} + } else { + args = slices.Insert(args, 0, "run") + } } watcher, err := watcher.New()@@ -120,7 +128,7 @@ syscall.SIGTERM, ) defer cancel() - cmd := command.New(program, flag.Args(), command.Options{}) + cmd := command.New(program, args, command.Options{}) sm := state.New(cmd, log.New(os.Stderr, "state: ", log.Lmsgprefix)) Start(ctx, watcher, sm) }