gowatch

command module
v0.0.0-...-ab8b613 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2023 License: MIT Imports: 11 Imported by: 0

README

gowatch

A simple program that executes a command on file changes in the selected directory (current directory by default).


To install run:

go install github.com/dele256/gowatch@latest

When rerunning the given command, all sub-processes spawned by the command are also killed.

gowatch -c "go run ."

go run launches your program after it has built it, meaning we are launching the go executable with our command. But since we are assigning a PGID before launching the command (the go executable) we can kill all sub-processes aswell before rerunning the command again.

Usage of gowatch:

  • -c string

    command to run e.g. "go run ."
    
  • -d string

    run directory, the directory to run the command in (default "./")
    
  • -f string

    comma separated extensions to watch e.g. "go,cc,c,h" (default="")
    
  • -g

    include .git folder (default=false)
    
  • -w string

    watch directory, directory to recursively watch (default "./")
    

Makefile example to run a make command and to only watch go files:

gowatch -c "make run" -f go

Then inside the Makefile we can have something like this:

run:
      go build -o build/example.out main.go
      (cd build && ./example.out)

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL