#!/usr/bin/env php

<?php
$autoloadPath1 = __DIR__ . '/../../../autoload.php';
$autoloadPath2 = __DIR__ . '/../vendor/autoload.php';
if (file_exists($autoloadPath1)) {
    require_once $autoloadPath1;
} else {
    require_once $autoloadPath2;
}

$doc = <<<DOC
Generate diff

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

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

$args = \Docopt::handle($doc);

try {
    $diff = \Differ\genDiff($args['--format'], $args['<firstFile>'], $args['<secondFile>']);
    print_r($diff . "\n");
} catch (Exception $e) {
    echo $e->getMessage() . "\n";
}
