All Projects → borntyping → spotter

borntyping / spotter

Licence: MIT license
A command line tool for watching files and running shell commands when they change

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to spotter

Jsonwatch
Track changes in JSON data from the command line
Stars: ✭ 130 (+400%)
Mutual labels:  watch
Awesome Programming Presentations
Presentations that programmers should watch
Stars: ✭ 162 (+523.08%)
Mutual labels:  watch
Node Inotify
Inotify bindings for Node.JS
Stars: ✭ 237 (+811.54%)
Mutual labels:  watch
Funzzy
Yet another fancy watcher. (Rust)
Stars: ✭ 142 (+446.15%)
Mutual labels:  watch
Hitrava
Convert your Huawei Health sport activities and import them in Strava.
Stars: ✭ 156 (+500%)
Mutual labels:  watch
Beefun Pro
Github client for iOS in Swift.
Stars: ✭ 172 (+561.54%)
Mutual labels:  watch
Youtube Local
browser-based client for watching Youtube anonymously and with greater page performance
Stars: ✭ 112 (+330.77%)
Mutual labels:  watch
PowerShell-Watch
A PowerShell Watch-Command cmdlet for repeatedly running a command or block of code until a change in the output occurs.
Stars: ✭ 49 (+88.46%)
Mutual labels:  watch
Eslint Watch
ESLint with simple watching capabilities
Stars: ✭ 159 (+511.54%)
Mutual labels:  watch
Redux Subscriber
Subscribe to changes in any part of redux state
Stars: ✭ 205 (+688.46%)
Mutual labels:  watch
Klap
zero config, zero dependency bundler for tiny javascript packages
Stars: ✭ 143 (+450%)
Mutual labels:  watch
Witness
Monitor file system events using Swift
Stars: ✭ 150 (+476.92%)
Mutual labels:  watch
Newpipe
A libre lightweight streaming front-end for Android.
Stars: ✭ 15,786 (+60615.38%)
Mutual labels:  watch
Swagger Ui Watcher
Automatically refreshes Swagger UI on Swagger file changes
Stars: ✭ 135 (+419.23%)
Mutual labels:  watch
Every Single Day I Tldr
A daily digest of the articles or videos I've found interesting, that I want to share with you.
Stars: ✭ 249 (+857.69%)
Mutual labels:  watch
On Change
Watch an object or array for changes
Stars: ✭ 1,709 (+6473.08%)
Mutual labels:  watch
Js Must Watch
Must-watch videos about javascript
Stars: ✭ 12,696 (+48730.77%)
Mutual labels:  watch
clipboard-watch
This is height performance clipboard watcher, support windows,osx
Stars: ✭ 21 (-19.23%)
Mutual labels:  watch
ytmous
Anonymous Youtube Proxy
Stars: ✭ 60 (+130.77%)
Mutual labels:  watch
My Ttgo Watch
Firmware for a ttgo-watch2020-v1 smartwatch based on ESP32 from LilyGo.
Stars: ✭ 192 (+638.46%)
Mutual labels:  watch

spotter

Latest PyPI version

Spotter is a simple command line tool for watching files and running shell commands when they change. Directives are read from a text file, and spotter will look for a file named .spotter in the current directory if no filenames are given.

Usage

spotter [-h] [-v] [-q] [-c] [filename [filename ...]]
Positional arguments:
  • filename: A list of files containing directives to load, defaulting to [".spotter"].
Optional arguments:
  • -h, --help: Explain the command line options.
  • -v, --version: Show the current version number.
  • -q, --quiet: The output of commands is not printed unless they fail.
  • -c, --continue: Failed commands will not stop spotter from continuing.

Spotter can also be run as a python module:

python -m spotter ...

Directives

All directives are in the following form:

<directive>: <argument> [-> <second argument>]

Not all directives take a second argument, but all of them take a first argument.

Watch

watch: <pattern> -> <command>

The Watch directive takes two arguments: <pattern> is a unix-style filename pattern, and <command> is a shell command to run when a file matching the pattern is created or changed. More information on the pattern matching used can be found in the fnmatch library documentation.

watch: *.txt -> echo "Text file changed"

Multiple watch directives can be given, and spotter will continue to run matching watch directives until one fails (i.e. returns an exit code above 0) or until it runs a matching watch-final directive.

watch: * -> return 1
watch: * -> echo "This command will not run"

The --continue command line argument can be used to disable this behaviour, forcing spotter to continue processing watches even if one fails.

Watch-Final

watch-final: <pattern> -> <command>

Watch-final has exactly the same syntax and behaviour as the Watch directive. Unlike the Watch directive, if the pattern matches and the command is run, no further watches will be processed.

watch-final: *.txt -> echo "No commands will run after this"

Start / Stop

start: <command>
stop: <command>

The start and stop directives can be used to run commands when spotter starts running and when spotter stops running.

start: echo "Started watching files"
stop: echo "Stopped watching files"

Define

define: <name> -> <value>

The Define directive allows values to be stored and then included in other directives when they are run. filename is always available in watch commands, and contains the path of the file that matched the pattern. Definitions are included in the commands using python format specifications, and are inserted when the command is run, not when the command is loaded.

define: python_command -> python2.6

watch: *.py -> {python_command} "{filename}"
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].