Categorygithub.com/krashanoff/parallel
repositorypackage
0.1.0
Repository: https://github.com/krashanoff/parallel.git
Documentation: pkg.go.dev

# README

parallel

A small CLI application that looks to take GNU's parallel and run with its ideas in Go.

Example

# first, let's create some files.
for i in {1..24}; do
  head -c `expr $i \* 500` /dev/urandom > "test/$i"
done

# cat all files with four threads in
# operation.
parallel -j 4 cat {} \; ./test/*

# cat all files with twelve threads in
# operation, but cull jobs that take
# over 50ms of execution time.
parallel -j 12 -t 50 cat {} \; ./test/*

# taking input from stdin.
find test | grep '1.*' | parallel -j 6 -t 100 cat {} \; -

# a slightly more realistic application:
# threading pandoc on each markdown file
# in a folder of notes.
parallel -j 6 pandoc -f markdown -t latex -o {}.pdf {} \; ./notes/*.md

Running

You can get the binary built for your system from the releases page.

Building Your Own

Requires:

  • GNU Make
  • Go
git clone https://github.com/krashanoff/parallel.git
make
./bin/parallel --help

Stuff to add

  • Better summary at termination (culled jobs, etc.).
  • Reference file-name components within {} syntax. For example, {:-1} to get the last component.