similar
Version, currently main branch1 version
- main branchlatestFeb 2, 2026
github.com/dsisnero/similar.cr
Crystal port of the similar diff library
0 stars
2 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
similar:
github: dsisnero/similar.cr
branch: mainmain is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
>= 1.19.1- License
- MIT
- Author
- dsisnero
- Target
similarfrom src/similar.cr
Dependencies
Development Dependencies
- ameba*github: crystal-ameba/amebadev
README
similar
A Crystal port of the Rust similar diff library.
Installation
Add this to your application's shard.yml:
dependencies:
similar:
github: dsisnero/similar
Then run:
shards install
Usage
Basic text diff:
require "similar"
diff = Similar::TextDiff.from_lines("a\nb\n", "a\nB\n")
diff.iter_all_changes.each do |change|
puts "#{change.tag}: #{change.value}"
end
Unified diff:
require "similar"
old_text = "Hello\nWorld\n"
new_text = "Hello\nCrystal\n"
diff = Similar::TextDiff.from_lines(old_text, new_text)
puts diff.unified_diff.header("old.txt", "new.txt").to_s
Close matches:
require "similar"
matches = Similar.get_close_matches("appel", ["ape", "apple", "peach", "puppy"], 3, 0.6)
pp matches
Development
Run formatting, linting, and specs:
crystal tool format
ameba --fix
ameba
crystal spec
Contributing
- Fork it (https://github.com/dsisnero/similar/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- dsisnero - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
main- Seen
- Feb 2, 2026
- Crystal
>= 1.19.1- Indexed
- yes
Dependents
Repository
github.com/dsisnero/similar.cr
Metadata
- Created
- Aug 19, 2026
- Updated
- Sep 17, 2026
- Synced
- Sep 17, 2026
- Versions
- 1