steeloverseer: A file watcher and development tool.

[ bsd3, development, library, program ] [ Propose Tags ]

A command line tool that responds to filesystem events. Allows the user to automatically execute commands after files are added or updated. Watches files using regular expressions.


[Skip to Readme]

Modules

[Last Documentation]

  • ANSI
  • Job
  • Rule
  • Sos
  • Template

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.1, 0.1.0.2, 0.2.0.0, 0.5.0.0, 0.5.0.1, 1.0.1.0, 1.1.0.0, 1.1.0.1, 1.1.0.2, 1.1.0.3, 1.1.0.4, 1.1.0.5, 1.1.0.6, 1.1.1.0, 2.0, 2.0.0.1, 2.0.1.0, 2.0.2.0, 2.1.0.0, 2.1.0.1
Dependencies aeson, ansi-terminal, async, base (>=4.0 && <6.0), bytestring, containers, directory, filepath, fsnotify (<0.3), megaparsec (<5), microlens, mtl, optparse-applicative, process, regex-tdfa, semigroups, steeloverseer, stm, text, yaml [details]
License BSD-3-Clause
Author Schell Scivally, Mitchell Rosen
Maintainer schell.scivally@synapsegrop.com
Revised Revision 2 made by Bodigrim at 2022-04-16T17:22:36Z
Category Development
Home page https://github.com/schell/steeloverseer
Bug tracker https://github.com/schell/steeloverseer/issues
Source repo head: git clone git://github.com/schell/steeloverseer.git
Uploaded by SchellScivally at 2016-07-05T18:38:06Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Executables sos
Downloads 13388 total (55 in the last 30 days)
Rating 2.25 (votes: 2) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2016-11-22 [all 2 reports]

Readme for steeloverseer-2.0

[back to package description]

Steel Overseer

A file watcher and development tool, similar to Ruby's Guard.

Build Status

Installation

Download and install the stack build tool.

stack install steeloverseer

This will create a binary deep inside ~/.stack/, and symlink to it at ~/.local/bin/sos.

Usage

See sos --help to get started:

Steel Overseer 2.0

Usage: sos [TARGET] [-c|--command COMMAND] [-p|--pattern PATTERN]
  A file watcher and development tool.

Available options:
  -h,--help                Show this help text
  TARGET                   File or directory to watch for
                           changes. (default: ".")
  -c,--command COMMAND     Add command to run on file event.
  -p,--pattern PATTERN     Add pattern to match on file path. Only relevant if
                           the target is a directory. (default: .*)

Capture groups can be created with ( ) and captured variables can be referred to with \1, \2, etc. (\0 contains the entire match).

For example, for each change to a .c file in src/, we may want to compile the file and run its corresponding unit test:

sos src/ -c "gcc -c \0 -o obj/\1.o" -c "make test --filter=test/\1_test.c" -p "src/(.*)\.c"

Commands are run left-to-right, and one failed command will halt the entire pipeline.

As a shortcut, we may want to write the above only once and save it in .sosrc, which is an alternative to the command-line interface (yaml syntax):

- pattern: src/(.*)\.c
  commands:
  - gcc -c \0 -o obj/\1.o
  - make test --filter=test/\1_test.c

Then, we only need to run

sos

to start watching the current directory.

Pipelines of commands are immediately canceled and re-run if a subsequent filesystem event triggers the same list of commands. Otherwise, commands are are enqueued and run sequentially to keep the terminal output clean and readable.

For example, we may wish to run hlint on any modified .hs file:

- pattern: .*\.hs
  command: hlint \0

We can modify foo.hs and trigger hlint foo.hs to run. During its execution, modifying bar.hs will enqueue hlint bar.hs, while modifying foo.hs again will re-run hlint foo.hs.

.sosrc grammar

sosrc            := [entry]
entry            := { "pattern" | "patterns" : value | [value]
                    , "command" | "commands" : value | [value]
                    }
value            := [segment]
segment          := text_segment | var_segment
text_segment     := string
var_segment      := '\' integer

The .sosrc grammar is somewhat flexible with respect to the command specifications. Both singular and plural keys are allowed, and both strings and lists of strings are allowed for values.