autocmd

command module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

README

autocmd

Automatically run a command when one of the watched sources changes.

Documentation

Overview

The autocmd command is used to execute a command when some source file changes. The source files can be specified as actual path names or using shell metacharacters (e.g., *.go).

The typical usage is:

autocmd --clear '*.go' -- go test

Normally autocmd immediately executes the specified command. The --wait option causes autocmd wait for the first change to the file before executing the command.

The --go flag is a short cut to specify --clear and all .go files from the current directory on down. The --go flag implies --, typical usage;

autocmd --go go test

Multiple sets of commands can be set to run by separating them with ---. For example:

autocmd grammer.y -- goyacc -o grammar.go grammar.y \
	--- .../*.go go build

This will cause autocmd to run goyacc if grammer.y changes and go build if any .go file changes. If grammar.y changes then grammer.go will change which will trigger the go build.

CONFIG

A config file, specified by --config, can be used to alter the patterns looked for by --go. An example configuration:

# this is a comment
go: .../*.go
go: .../*.sdl
go: BUILD

Jump to

Keyboard shortcuts

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