Skip to content

benjeffery/yapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#YAPP - YAPP Ain't a Pre-Processor

YAPP is a small tool for running commands over sets of files

##Installation

pip install http://github.com/benjeffery/yapp/raw/master/dist/yapp-0.1.0.tar.gz

Usage

yapp [-h] [--verbose] root_directory

YAPP will find all *.yapp.yaml files under the root_directory and process them in turn.

Config

Each config({name}.yapp.yaml) currently needs to contain two lines:

input_file_pattern: '*.jpg'                                   #A file pattern in the usual unix glob style
command: 'convert {input_file} -resize 50% {input_file}.png'  #A command to be run 

For each {name}.yapp.yaml YAPP will create an output directory called {name} It will then run the command for all matching files in the same directory as the config, substituting in the file name where {input_file} occurs, using the output directory as the working directory for the command.

While the command is running stdout is saved to {input_file}.working and stderr to {input_file}.err. If the exit code of the command is 0 then {input_file}.working is moved to {input_file} and {input_file}.err deleted if empty.

If {input_file} already exists in the output directory with an mtime more recent than the input file then the command is skipped. "Touch"ing the input file will cause the mtime to change.

##FAQ ####Can't you just do this with xargs? Yes

About

Run commands over sets of files

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages