#!/usr/bin/env php setTagline(pht('show prose differences')); $args->setSynopsis(<<parseStandardArguments(); $args->parse( array( array( 'name' => 'files', 'wildcard' => true, ), )); $files = $args->getArg('files'); if (count($files) !== 2) { $args->printHelpAndExit(); } $old_file = head($files); $new_file = last($files); $old_data = Filesystem::readFile($old_file); $new_data = Filesystem::readFile($new_file); $engine = new PhutilProseDifferenceEngine(); $prose_diff = $engine->getDiff($old_data, $new_data); foreach ($prose_diff->getParts() as $part) { switch ($part['type']) { case '-': echo tsprintf('%B', $part['text']); break; case '+': echo tsprintf('%B', $part['text']); break; case '=': echo tsprintf('%B', $part['text']); break; } }