diff --git a/README.md b/README.md index ec3c556..d18b885 100644 --- a/README.md +++ b/README.md @@ -10,4 +10,7 @@ ## Gendiff process with YAML files in asciinema: - \ No newline at end of file + + +## Gendiff process with json and YAML files with nested structure in asciinema: + \ No newline at end of file diff --git a/bin/gendiff b/bin/gendiff index d81304c..0c03799 100755 --- a/bin/gendiff +++ b/bin/gendiff @@ -23,11 +23,11 @@ Usage: Options: -h --help Show this screen. -v --version Show version. - --format Report format [default: json] + --format Report format [default: stylish] DOC; -$args = Docopt::handle($doc, array('version'=>'Generate diff version 0.1 (12.10.2024)'))->args; +$args = Docopt::handle($doc, array('version'=>'Generate diff version 0.2 (21.10.2024)'))->args; if (array_key_exists("", $args) & array_key_exists('', $args)) { - $result = genDiff($args[''], $args['']); + $result = genDiff($args[''], $args[''], $args['--format']); print_r($result); } diff --git a/tests/DiffTest.php b/tests/DiffTest.php index aa4593a..8af3e1f 100644 --- a/tests/DiffTest.php +++ b/tests/DiffTest.php @@ -43,4 +43,13 @@ public function testFilesDiffYaml(): void $diffStringFromFiles = genDiff($pathToFile1, $pathToFile2); $this->assertStringEqualsFile($pathToFile3, $diffStringFromFiles); } + + public function testFilesDiffYaml2(): void + { + $pathToFile1 = $this->getFixtureFullPath('2/file1.yaml'); + $pathToFile2 = $this->getFixtureFullPath('2/file2.yml'); + $pathToFile3 = $this->getFixtureFullPath('2/result.txt'); + $diffStringFromFiles = genDiff($pathToFile1, $pathToFile2); + $this->assertStringEqualsFile($pathToFile3, $diffStringFromFiles); + } }