Giter Club home page Giter Club logo

argos's Introduction

argos

Argos is a small program that can watch files and run commands when the file emits a specified inotify event.

Building

The shell script make.sh is both the build script and the install script. It needs permission to access /usr/local/bin to install the executable and /usr/local/man/ to add the man page.

$ git clone https://github.com/BlueishSapphire/argos.git
$ cd argos
$ sudo ./make.sh

Running

argos [events... <command>] files...

files... is a list of files to watch.

events... <command> specifies to run command whenever one of the specified events is fired, where event is one of:

Short name Long name inotify event(s)
-X --all *
-A --access ACCESS
-M --modify MODIFY
-O --open OPEN
-C --create CREATE
-S --close CLOSE_WRITE, CLOSE_NOWRITE
-D --delete DELETE
-B --attrib ATTRIB

Examples

Example 1

$ argos -M 'make' ./*.c

This command watches all files in the current directory with the ".c" extension and runs make when one of them gets modified.

This command has two main parts:

  1. -M 'make' specifies that when a file is modified (-M), it should run make ('make').

  2. ./*.c specifies to watch all ".c" files in the current directory

Example 2

$ argos -M 'pandoc $file -o ${file##md}.pdf' ./*.md

This is a script that I often use while working on markdown files when I want a live preview. It waits for any markdown file to be modified, then uses pandoc (a document conversion utility) to convert the markdown file into a pdf.

This command has two main parts:

  1. -M 'pandoc $file -o ${file##md}.pdf' runs pandoc whenever one of the speciied files is modified ($file gets replaced with the name of the file, and ${file##md} is some bash magic for removing the ".md" suffix from the filename)

  2. ./*.md specifies to watch all markdown files in the current directory

argos's People

Stargazers

bey avatar

Watchers

BlueishSapphire 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.