Skip to content
Command-line program for batch processing
Branch: master
Clone or download
alexherbo2 Merge pull request #1 from TeddyDD/fix-crystal-0.29
remove question mark in something_to_do? variable
Latest commit ee4c5bc Jun 13, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Initial commit Jun 12, 2019
scripts Initial commit Jun 12, 2019
spec Initial commit Jun 12, 2019
src remove question mark in something_to_do? variable Jun 12, 2019
.gitignore Initial commit Jun 12, 2019
.travis.yml Initial commit Jun 12, 2019
CONTRIBUTING Initial commit Jun 12, 2019
Makefile Initial commit Jun 12, 2019
README.md Initial commit Jun 12, 2019
UNLICENSE Initial commit Jun 12, 2019
shard.yml Initial commit Jun 12, 2019

README.md

Batch

Build Status

Usage | Configuration | Options | Contributing

Command-line program for batch processing.

Batch demo

Dependencies

Installation

make build # Build bin/batch
make install # Install bin/batch and scripts into ~/.local/bin

Usage

batch

Opens a list of elements in an external editor.

Elements can be received from the argument list or stdin.

Example – Running Batch with Star Platinum, Magician’s Red, Hermit Purple, Hierophant Green, Silver Chariot and The Fool:

input.txt

Star Platinum
Magician’s Red
Hermit Purple
Hierophant Green
Silver Chariot
The Fool

Edit the file:

input.txt

star-platinum

hermit-purple

silver-chariot

After you edit and save the file, it will generate a shell script which does batch actions according to the changes you did in the file.

output.sh

# This file will be executed when you close the editor.
# Please double-check everything, clear the file to abort.

map() {
  echo map "$1""$2"
}
map 'Star Platinum' 'star-platinum'
map 'Hermit Purple' 'hermit-purple'
map 'Silver Chariot' 'silver-chariot'

drop() {
  echo drop "$1"
}
drop 'Magician’s Red'
drop 'Hierophant Green'
drop 'The Fool'

This shell script is opened in an editor for you to review. After you close it, it will be executed.

Configuration

batch_rename() {
  batch --map 'rename "$1" "$2"' "$@"
}

batch_convert() {
  batch --map 'convert "$1" "$2"' "$@"
}

batch_relink() {
  batch --map 'relink "$1" "$2"' "$@"
}

alias rn=batch_rename
alias cv=batch_convert
alias rl=batch_relink

Options

--pick / -p command
  Run command on unchanged elements.

--map / -m command
  Run command on modified elements.

--drop / -d command
  Run command on deleted elements.

--editor command
  Configure editor.
  If command contains spaces, command must include "${@}" (including the quotes)
  to receive the argument list.

--no-confirm
  Do not ask for confirmation.

--help / -h
  Display a help message and quit.
You can’t perform that action at this time.