Giter VIP home page Giter VIP logo

watchout's Introduction

Watchout

A cross platform reloading image viewer combined with a command executor.

Watchout will do any of the following:

  • Run a command when any file in a set of Paths changes. After the command is done running, it will reload and display an image. Imagine you're working on a SQL query to generate a chart. Whenever you save the SQL file Watchout would run a specific command (say generate-chart.py query.sql) and upon completion would reload the image that was generated by generate-chart.py.
  • Check if an image on disk changed and if that is the case re-display the image.

Watchout should run cross platform, but it has only been tested on macOS.

Demo

watchout.mov

(In this demo you can see watchout running cargo run --example image whenever the image.rs file is saved. The image example writes output.png to disk which is displayed by watchout.

Usage

Watchout has to be started from the terminal, quick example:

watchout image -img /path/to/image.png

This will start watchout with an image and redisplay the image if it changes.

Running with a command. Below will run cargo run --example generate_image whenever anything in /proj/bam/src or /proj/bam/examples changes. Once it finished running, it will reload /proj/bam/output.png.

watchout command-image -c "cargo run --example generate_image" -w /proj/bam/src -w /proj/bam/examples -i /proj/bam/output.png

There's another mode where the output of the cmd can define the image to be displayed. In this case, the last line of output from cmd should only be the path to the image that is to be displayed:

watchout command-output -c "cargo run --example generate_image" -w /proj/bam/src

In this example, whenever /proj/bam/src changes, watchout will run cargo run --example generate_image and then take the last line of output from running cargo run --example generate_image, interpret that as the path to an image, and load that image.

Full Usage

USAGE:
    watchout [SUBCOMMAND]

OPTIONS:
    -h, --help       Print help information
    -V, --version    Print version information

SUBCOMMANDS:
    command-image     Perform [cmd] when the [watch] folder (recursively) changes and then
                      reload [img]
    command-output    Perform [cmd] when the [watch] folder (recursively) changes and then
                      reload the image at the path in the last line of the [cmd] output
    help              Print this message or the help of the given subcommand(s)
    image             Reload [img] when it changes

Building

cargo build --release

If you want your executable to have a proper icon, you can use cargo bundle (cargo install cargo-bundle):

cargo bundle --release

Or, on macOS

./build_mac.sh

Todo

  • Better error handling (e.g. displaying an error)
  • Allow manually reloading an image / running the command
  • Allow zooming / panning of the image
  • Show the log output in the app

Libraries

Watchout was build using these fine libraries

watchout's People

Contributors

terhechte avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.