{"id":15713687,"url":"https://github.com/aleandros/tdiff","last_synced_at":"2025-05-12T21:59:25.297Z","repository":{"id":78380316,"uuid":"259989408","full_name":"aleandros/tdiff","owner":"aleandros","description":"CLI tool for comparing tree like structures","archived":false,"fork":false,"pushed_at":"2020-06-02T21:59:16.000Z","size":62,"stargazers_count":21,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-20T18:40:00.370Z","etag":null,"topics":["cli","crystal","crystal-lang","json","yaml"],"latest_commit_sha":null,"homepage":null,"language":"Crystal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aleandros.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-29T17:06:15.000Z","updated_at":"2024-03-09T22:06:46.000Z","dependencies_parsed_at":"2023-06-12T03:30:16.364Z","dependency_job_id":null,"html_url":"https://github.com/aleandros/tdiff","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleandros%2Ftdiff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleandros%2Ftdiff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleandros%2Ftdiff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleandros%2Ftdiff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aleandros","download_url":"https://codeload.github.com/aleandros/tdiff/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253830913,"owners_count":21971001,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","crystal","crystal-lang","json","yaml"],"created_at":"2024-10-03T21:32:54.149Z","updated_at":"2025-05-12T21:59:25.241Z","avatar_url":"https://github.com/aleandros.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tdiff\n\n[![Built with Crystal](https://img.shields.io/badge/built%20with-crystal-000000.svg?style=flat-square)](https://crystal-lang.org/)\n[![CI](https://github.com/aleandros/tdiff/workflows/CI/badge.svg)](https://github.com/aleandros/tdiff/actions?query=workflow%3ACI)\n[![Latest release](https://img.shields.io/github/release/aleandros/tdiff.svg)](https://github.com/aleandros/tdiff/releases)\n\nA tool for comparing Tree like files, specifically JSON and YAML\n\n## Installation\n\nRight now, simply go to the [releases page](https://github.com/aleandros/tdiff/releases) and download\nthe latest binary to your prefered directory in your path (like `/usr/local/bin`). This applies for both\nwindows and linux\n\n### Using snap on Linux\nIf you have `snap` on your system, you can install it with\n\n```shell\n$ sudo snap install --beta tdiff # I hope to be able to consider it out of beta soon\n```\n\n### Using Homebrew for OSX\n\n```shell\n$ brew tap aleandros/tdiff\n$ brew install tdiff\n```\n\n## Usage as a binary\n\nUsage: `tdiff [OPTION]... [SOURCE] \u003cTARGET\u003e`\n\nIdentifies the differences between two tree-like file structures.\n\nIf `\u003cTARGET\u003e` is not present, input is assumed to come from STDIN.\nAt this moment, only JSON and YAML are supported.\n\nAn exit status of 1 indicates an error in the program.\nAn exit status of 127 indicates that there are differences between source\nand target.\nAn exit status of 0 indicates no changes\n\nExample output:\n\n```shell\n$ tdiff shard.yml shard.lock\n- name: tdiff\n* version: changed type from string to float\n- authors: [\"Edgar Cabrera \u003cedgar.cabrera@pm.me\u003e\"]\n- targets: {\"tdiff\" =\u003e {\"main\" =\u003e \"main.cr\"}}\n- crystal: 0.34.0\n- license: MIT\n- development_dependencies: {\"ameba\" =\u003e {\"github\" =\u003e \"crystal-ameba/ameba\", \"version\" =\u003e \"~\u003e 0.12.0\"}}\n+ shards: {\"ameba\" =\u003e {\"github\" =\u003e \"crystal-ameba/ameba\", \"version\" =\u003e \"0.12.1\"}}\n```\n\n## Usage as a shard\n\nAdd it to your application shards:\n\n```yaml\ndependencies:\n  tdiff:\n    github: aleandros/tdiff\n```\n\nIt just requires a couple of IO objects, containing the YAML or JSON data, \nand returns a list of `Tdiff:Core::Result` objects.\n\n```crystal\nrequire \"tdiff\"\n\ncomparator = Tdiff.compare(File.open('target_1.yml'), File.open('target_2.yml'))\ncomparator.compare\ncomparator.results.each do |result|\n  puts \"#{result.path.join(\".\")}: #{result.difference.reason}\"\nend\n```\n\nIf any of the inputs cannot be parsed, this method will raise a `Tdiff::Exception` error.\n\n## Development\n\nThis is a pretty standard crystal project. So install crystal with your prefered method.\n\nFirst install dependencies with `shards install`.\n\nRemember to run:\n\n* Tests with `crystal spec`\n* Format with `crystal tool format`\n* Ameba checks with `bin/ameba`\n\nThis will be checked by CI but still save yourself some time.\n\n### Documentation\n\nYou can find the documentation [here](https://aleandros.github.io/tdiff/)\n\n## TODO\n- [x] Compare file to STDIN\n- [x] Compare yamls\n- [x] Compare json\n- [x] Presentation layer\n- [x] Add auto-publish via github actions and installation instructions\n- [x] Add portable binaries for OSX (or homebrew package)\n- [x] Publish as snap package\n- [x] Add portable binary for Windows\n- [x] Fix file permission testing in CI\n- [x] Allow `Tdiff::Core` to be used as a library\n- [ ] Support more array comparison algorithms\n- [ ] Allow presentation-level customizations at runtime\n\n## Contributing\n\n1. Fork it (\u003chttps://github.com/aleandros/tdiff/fork\u003e)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Edgar Cabrera](https://github.com/aleandros) - creator and maintainer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleandros%2Ftdiff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faleandros%2Ftdiff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleandros%2Ftdiff/lists"}