#!/usr/bin/env php

<?php

use function Differ\Differ\genDiff;

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

$doc = <<<'DOCOPT'
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: stylish]
  
DOCOPT;

$result = \Docopt::handle($doc, array('version'=>'1.0.0'));

$path1 = realpath($result["<firstFile>"]);
$path2 = realpath($result["<secondFile>"]);
$format = $result["--format"];

print_r (genDiff($path1, $path2, $format));
