unixorn/tumult.plugin.zsh

View on GitHub
bin/mergepdfs

Summary

Maintainability
Test Coverage
#!/usr/bin/env bash
#
# Merge PDF files
#
# Copyright 2020, Joe Block <jpb@unixorn.net>

set -o pipefail

if [[ "$(uname -s)" != 'Darwin' ]]; then
  echo 'Sorry, this script only works on macOS'
  exit 1
fi

usage() {
  echo "Usage:"
  # shellcheck disable=SC2086
  echo "$(basename $0) -o outputname.pdf input1.pdf input2.pdf input{3,4}.pdf"
}

if [[ $# -eq 0 ]]; then
  usage
  exit 0
fi

# shellcheck disable=SC2068
/System/Library/Automator/Combine\ PDF\ Pages.action/Contents/Resources/join.py $@