Giter Site home page Giter Site logo

rs-filewatch-trigger's Introduction

FileWatch Trigger

FileWatch Trigger application in Rust. The binary is named fwt.

The application watches for any type of file changes in the recursively watched directory, and triggers the given action.

Currently able to perform the following action(s):

  • Run shell template command with path and event

How to install

You may also choose to visit releases and download the latest version of statically built binary in the zip asset.

Alternatively, if you have the cargo command, simply run

cargo install rs-filewatch-trigger

Example Command

For help:

fwt -h

The following contains the help message:

USAGE:
    fwt [FLAGS] [OPTIONS] <path> <SUBCOMMAND>

FLAGS:
        --force-poll    Force using polling implementation, works for any platform
    -h, --help          Prints help information
        --relative      Use relative path instead of absolute path for path matches
    -V, --version       Prints version information
    -v, --verbose       Verbose mode (-v, -vv, -vvv)

OPTIONS:
    -d, --delay <delay_ms>     Delay interval in milliseconds between each file watch detection [default: 1000]
    -e, --event <event>        Event type to trigger on (0=NONE, 1=CREATED, 2=DELETED, 4=MODIFIED, 8=MOVED) [default: 1]
    -f, --filters <filters>    Glob pattern(s) for file matching (comma delimited) [default: *.*]

ARGS:
    <path>    Directory path to watch recursive

SUBCOMMANDS:
    cmd     FileWatch Trigger to run various actions
    help    Prints this message or the help of the given subcommand(s)

Shell template command action

Assuming the current working directory is /home/xxx:

fwt -e 15 \
    -f "*.jpg,*.png" \
    -v \
    . \
    cmd --print-stdout "echo {path}: {event}"

Example output:

/home/xxx/a.jpg: CREATED

The following contains the help message for this action:

USAGE:
    fwt cmd [FLAGS] <cmd>

FLAGS:
    -h, --help            Prints help information
        --print-stderr    Prints shell stderr to main stderr
        --print-stdout    Prints shell stdout to main stdout
    -V, --version         Prints version information

ARGS:
    <cmd>    Shell template command to run with string interpolation ({path}: triggered file path) ({event}: event
             type number)

rs-filewatch-trigger's People

Contributors

guangie88 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

bogdanbiv

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.