Lockdiff is both an executable binary that can be run, and a library that can be used in Rust programs.
Installing the command-line executable
Assuming you have Rust/Cargo installed , run this command in a terminal:
cargo install lockdiff
It will make the lockdiff command available in your PATH if you've allowed the PATH to be modified when installing Rust . cargo uninstall lockdiff uninstalls.
Adding lockdiff library as a dependency
Run this command in a terminal, in your project's directory:
cargo add lockdiff
To add it manually, edit your project's Cargo.toml file and add to the [dependencies] section:
lockdiff = "2.0.5"
The lockdiff library will be automatically available globally.
Read the lockdiff library documentation .
Back to the crate overview .
Readme
Lockdiff
Convert a lock with lots of info to something more readable
For instance:
[[ package ]]
name = " foo"
version = " 1.4"
becomes:
foo ( 1. 4 )
Using lockdiff with git
The primary purpose of this tool is to hide "noise" related to package changes
in automatically generated files such as Cargo. lock when using with git diff
and related commands.
For this to work, you need to register the 'lockdiff' as a text converter
in your git config (usually ~/.config/git/config )
[ diff "lockdiff" ]
textconv = lockdiff
and then tell git to use lockdiff when diffing files, in ~/.config/git/attributes :
Cargo. lock diff= lockdiff
Note: in case of requirements. txt , you may want to put the config in . git/ info/ attributes
because sometimes the requirements. txt is maintained by hand and not generated by a tool like pip-compile .
Supported locks
Cargo. lock
Gemfile. lock
composer. lock
go. sum
package- lock. json
poetry. lock
pubspec. lock
shard. lock
yarn. lock
requirements. txt and similar (the file name must contain requirements and end with . txt, like in dev- requirements. txt )