unchartedsoftware / witch

Licence: other
Dead simple watching

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to witch

faster-than-walk
Faster recursive directory walk on Python 3
Stars: ✭ 36 (+140%)
Mutual labels:  glob, recursive
toxic-decorators
Library of Javascript decorators
Stars: ✭ 26 (+73.33%)
Mutual labels:  watcher
auto-request-review
A GitHub Action that automatically requests review of a pull request based on files changes and/or groups the author belongs to 🤖
Stars: ✭ 52 (+246.67%)
Mutual labels:  glob
gobuild
Go 语言热编译工具
Stars: ✭ 49 (+226.67%)
Mutual labels:  watcher
droste-creator
Create recursive images with the droste effect.
Stars: ✭ 27 (+80%)
Mutual labels:  recursive
readdir
Recursively read a directory, blazing fast. Use with picomatch or micromatch to match globs.
Stars: ✭ 37 (+146.67%)
Mutual labels:  recursive
pytest-watcher
Rerun pytest when your code changes
Stars: ✭ 60 (+300%)
Mutual labels:  watcher
glob-tool
A tool to test globs against sets of test strings quickly and easily for the DigitalOcean Community.
Stars: ✭ 14 (-6.67%)
Mutual labels:  glob
delete-empty
Recursively delete all empty folders in a directory and child directories.
Stars: ✭ 38 (+153.33%)
Mutual labels:  glob
scelta
(experimental) Syntactic sugar for variant and optional types.
Stars: ✭ 140 (+833.33%)
Mutual labels:  recursive
glob-object
Filter an object using glob patterns and dot notation.
Stars: ✭ 25 (+66.67%)
Mutual labels:  glob
cheap-watch
If it works, why use something else? // Mirror of https://git.chor.date/Conduitry/cheap-watch
Stars: ✭ 64 (+326.67%)
Mutual labels:  watcher
compose-watcher
Watch volumes and restart services in docker compose
Stars: ✭ 27 (+80%)
Mutual labels:  watcher
dir-glob
Convert directories to glob compatible strings
Stars: ✭ 41 (+173.33%)
Mutual labels:  glob
replace-in-files
Replace text in one or more files or globs.
Stars: ✭ 21 (+40%)
Mutual labels:  glob
glob
Golang glob
Stars: ✭ 14 (-6.67%)
Mutual labels:  glob
watcher
The file system watcher that strives for perfection, with no native dependencies and optional rename detection support.
Stars: ✭ 37 (+146.67%)
Mutual labels:  watcher
bash-glob
Bash-powered globbing for node.js. Alternative to node-glob. Does not work on Windows 9 and lower.
Stars: ✭ 13 (-13.33%)
Mutual labels:  glob
extglob
Extended globs. Add (almost) the expressive power of regular expressions to glob patterns.
Stars: ✭ 25 (+66.67%)
Mutual labels:  glob
instance-watcher
Get notified for Instances mistakenly left running across all AWS regions for specific AWS Account
Stars: ✭ 90 (+500%)
Mutual labels:  watcher

witch

Dead simple watching

Build Status Go Report Card

screenshot

Description

Detects changes to files or directories and executes the provided shell command. That's it.

Features:

  • Supports double-star globbing
  • Detects files / directories added after starting watch
  • Watch will persist if executed shell command returns an error (ex. compile / linting errors)
  • Awesome magic wand terminal spinner

Note: Uses polling to work consistently across multiple platforms, therefore the CPU usage is dependent on the efficiently of your globs. With a minimal effort your watch should use very little CPU. Will switch to event-based once fsnofity has matured sufficiently.

Dependencies

Requires the Go programming language binaries with the GOPATH environment variable specified and $GOPATH/bin in your PATH.

Installation

go get github.com/unchartedsoftware/witch

Usage

witch --cmd=<shell-command> [--watch="<glob>,..."] [--ignore="<glob>,..."] [--interval=<milliseconds>]

Command-line args:

Flag Description
cmd Shell command to execute after changes are detected
watch Comma separated globs to watch (default: ".")
ignore Comma separated globs to ignore (default: "")
interval Scan interval in milliseconds (default: 400)
max-token-size Max output token size in bytes (default: 2048000)
no-spinner Disable fancy terminal spinner (default: false)

Globbing

Globbing rules are the same as doublestar which supports the following special terms in the patterns:

Special Terms Meaning
* matches any sequence of non-path-separators
** matches any sequence of characters, including path separators
? matches any single non-path-separator character
[class] matches any single non-path-separator character against a class of characters (see below)
{alt1,...} matches a sequence of characters if one of the comma-separated alternatives matches

Any character with a special meaning can be escaped with a backslash (\).

Character Classes

Character classes support the following:

Class Meaning
[abc] matches any single character within the set
[a-z] matches any single character in the range
[^class] matches any single character which does not match the class

Any globs resolved to a directory will be have all contents watched.

Example

witch --cmd="make lint && make fmt && make run" --watch="main.go,api/**/*.go"
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].