GitXplorerGitXplorer
z

witch

public
0 stars
3 forks
0 issues

Commits

List of commits on branch master.
Unverified
9ce5c639a025576624e1c7889170800aea46660b

Updating golint import path

zzeroviscosity committed 6 years ago
Unverified
fd4d5b39f90da75819454cdb7b131e0721d74183

Removing a☺b test

zzeroviscosity committed 6 years ago
Unverified
6c57a6c77d75709293cb5c41d4d10319e49d7942

Fix issue where resolved files were not being properly ignored.

kkbirk committed 6 years ago
Unverified
0653b6edaea21d9e6fb383463aad963e33f48565

Fix travis version parsing issue.

kkbirk committed 6 years ago
Unverified
65b94a83da98e8b335a141ee913483c567b250ce

Bump go version in travis.

kkbirk committed 6 years ago
Unverified
96a831a0c212ae1e56419bf6d4ab531c3c75dd6b

Fix black text color. Preserve TTY for command output. Switch from glide to dep.

kkbirk committed 6 years ago

README

The README file for this repository.

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)
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"