watch-file

command module
v0.0.0-...-3b410c5 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: MIT Imports: 14 Imported by: 0

README

watch-file

Run commands after a file changes.

Usage
 watch-file [FLAGS] <files or directories...>

 FLAGS:
    -c --cmd        commands to run
    -p --pattern    pattern to filter the changed files
Samples
# if you are modify a main.c file, and want to run it after every edit. you can use this tool like this.
watch-file -c='gcc -o main main.c' -c='./main' main.c
Command Hooks

{check} check last command exec result. stop if an error occur.

{kill} kill the running command, it used when you run a long wait program. like web etc.

$ # like a go web demo. has 2 steps, build and run.
$ # use {check} to stop if the build is error. and use {kill} stop the running web.
$ watch-file -p='**.go' -c='go build -o demo .' -c='{check}' -c='{kill}' -c='./demo'

$ # another is a flask demo with out debug mode
$ watch-file -p='**.py' -c='{kill}' -c='python app.py'
Placeholders

{file} the changed file path

{name} the changed file name without ext.

{ext} the changed file ext.

{dir} the changed file dir path.

$ # use like 'scss --watch' command
$ watch-file -p='**.scss' -c='sass {file} {dir}/{name}.css'
Files Pattern

Please refer to glob

Install
go get github.com/heramerom/watch-file

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