#!/usr/bin/env php

<?php

use function Differ\Differ\genDiff;

$doc = <<<DOC
Generate diff

Usage:
  gendiff (-h|--help)
  gendiff (-v|--version)
  gendiff [--format <fmt>] <firstFile> <secondFile>

Options:
  -h --help                     Show this screen
  -v --version                  Show version
  --format <fmt>                Report format [default: pretty]
DOC;

$autoloadPaths = [
    __DIR__ . '/../../../autoload.php',
    __DIR__ . '/../vendor/autoload.php'
];
foreach ($autoloadPaths as $autoloadPath) {
    if (file_exists($autoloadPath)) {
        require_once $autoloadPath;
        break;
    }
}

$args = Docopt::handle($doc, ['version' => 'Generate diff 1.0']);
['<firstFile>' => $firstFile, '<secondFile>' => $secondFile] = $args;

$diff = genDiff($firstFile, $secondFile);
print_r($diff);