Giter VIP home page Giter VIP logo

rust-compare-files's Introduction

compare-files

This a simple CLI tool to compare two files and show the differences. It is written in Rust.

The tool is inspired by the diff command and git changes visualization, but it is simpler and easier to use. Always, the first file is the reference, and the second file is the one to compare.

Installation

From crates.io

To install the tool, you need to have Rust installed. Then, you can run the following command:

cargo install compare-files

From source

or you can clone the repository:

git clone https://github.com/rohaquinlop/rust-compare-files.git
cd rust-compare-files
cargo install --path .

Usage

To compare two files, you can run the following command:

compare-files /path/to/file1 /path/to/file2

The output will show the differences between the two files. For example, if the files are:

file1.txt:
1
2
3
file2.txt:
1
3
4

The output will be:

1: 1
2: - 2
3: 3
3: + 4

The files you provided are differents!

Here is the summary:
+ 1 line added.
- 1 line deleted.

As you can see, the output shows the differences between both files. If you're using an ansi-compatible terminal, you can see the output with colors.

Let's say you have two files, file1.txt and file2.txt, and you want to compare them. You can run the following command:

compare-files file1.txt file2.txt

Even, you can compare them if they are in different directories:

compare-files ~/Documents/file1.txt ./file2.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.