saq

command module
v0.0.0-...-84bb0b5 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: GPL-3.0 Imports: 22 Imported by: 0

README

saq

A toolchain-agnostic live reload tool that supports automatic reloading of the browser when a file is changed.

Basic Example

saq \
    -s http://localhost:8081 \
    -t localhost:8080 \
    -i ./... \
    -x .git \
    --gitignoreFile .gitignore \
    -- bash -c 'make build && ./build/main --http localhost:8081'
# or equivalently
saq -- bash -c 'make build && ./build/main --http localhost:8081'

Note: go run does not propagate signals to the child process, so you should not use go run with saq. See https://github.com/golang/go/issues/40467.

How it works

saq acts as a reverse proxy. It works as follows:

  1. It injects a script into the HTML response that fetches an endpoint that blocks until a file change is detected.
  2. When a file change is detected, the server process is restarted, which saq then tries to connect by sending a HEAD request to the server.
  3. Once the server is up, the browser is reloaded.

Supported Platforms

saq only works on Linux due to its dependency on illarion/gonotify.

Help

Usage: ./saq [flags...] argv...
Flags:
  -x, --exclude strings          exclude directories/paths/globs (default [./.git,./.direnv,./vendor,*.tmpl])
      --generated-check string   command to check if a file is generated, executes $SHELL or /bin/sh otherwise (default "[[ $FILE == *.go ]] && grep \"^// Code generated by\" \"$FILE\"")
      --gitignore string         gitignore file to use, empty to disable (default ".gitignore")
  -i, --include string           include directory (default ".")
  -s, --source string            source URL of the upstream server (default "http://localhost:8081")
  -t, --target string            target address to listen on (default "localhost:8080")
  -v, --verbose                  verbose logging

Who made the name?

@FreezingSnail

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
proxy
Package proxy provides a more featureful abstraction on top of httputil.ReverseProxy.
Package proxy provides a more featureful abstraction on top of httputil.ReverseProxy.

Jump to

Keyboard shortcuts

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