Differ CLI is a command-line utility for comparing text files providing a visual difference between them. It allows users to quickly see the differences between two versions of a file and can be used in various contexts, such as version control, backup comparison, and more.
Differ CLI supports the following file formats for comparison:
- JSON Files (.json) - JavaScript Object Notation (JSON) formatted files.
- XML Files (.xml) - Extensible Markup Language files.
- YAML Files (.yaml, .yml) - YAML (YAML Ain't Markup Language) formatted files.
Currently, the utility is designed to work with text-based formats. Binary files and non-text formats are not supported.
To install Differ CLI, follow these steps:
-
Download the Installer Script: Download the installation script by running the following command in your terminal:
curl -L https://github.com/rostex/differ-cli/releases/download/v1.0.0/install-getdiff.sh -o install-getdiff.sh
-
Make the Script Executable: Change the permissions of the script to make it executable:
chmod +x install-getdiff.sh
-
Run the Installation Script: Execute the script to install the utility:
./install-getdiff.sh
The script will:
- Download the latest version of the getdiff.jar file.
- Create a directory called ~/.getdiff in your home directory.
- Place the JAR file inside this directory.
- Create a command script to launch the utility using Java.
- Add the installation directory to your PATH environment variable, so you can run the utility globally.
-
Verify Installation
To verify that the utility has been installed correctly, open a regular Command Prompt or PowerShell window and run the following command:getdiff --version
To install Differ CLI, follow these steps:
-
Download the Installer Script:
- To download it using the command line, open PowerShell and run the following command:
Invoke-WebRequest -Uri "https://github.com/rostex/differ-cli/releases/download/v1.0.0/install-getdiff.ps1" -OutFile "$env:USERPROFILE\Downloads\install-getdiff.ps1"
- Ensure that the file has been successfully downloaded and is located in your current directory (e.g.,
C:\Users\Your_Name\Downloads
).
-
Run the Installation Script
-
Open PowerShell as an Administrator. This is required to modify the PATH environment variable and make the utility globally available. To do this:
- Search for PowerShell in the Start menu.
- Right-click and choose Run as Administrator.
-
In PowerShell, navigate to the folder where the
install-getdiff.ps1
script was saved. For example, if the file is in your Downloads folder, use the following command:cd C:\Users\Your_Name\Downloads
-
Now, execute the script:
.\install-getdiff.ps1
The script will:
- Download the getdiff.jar file to C:\Users\Your_Name.getdiff.
- Create an executable command file getdiff.cmd to launch the utility.
- Add the installation directory to your PATH environment variable, allowing you to run the utility from anywhere in the command line.
-
After the script finishes, a message will be displayed indicating that the installation is complete.
-
-
Verify Installation
To verify that the utility has been installed correctly, open a regular Command Prompt or PowerShell window and run the following command:getdiff --version
After installation, you can use Differ CLI directly from the terminal with the following command:
getdiff <file1> <file2>
To compare two Yaml files:
getdiff --format=plain file1.yaml file2.yaml
This will output the differences between the two files in the terminal.
For more information:
# Plain format
getdiff --format=plain path/to/file.yml another/path/file.json
Property 'follow' was added with value: false
Property 'baz' was updated. From 'bas' to 'bars'
Property 'group2' was removed
# Stylish format
getdiff file1.json file2.json
{
+ follow: false
+ numbers: [1, 2, 3]
setting1: Value 1
- setting2: 200
- setting3: true
+ setting3: {key=value}
+ setting4: blah blah
}
If you wish to uninstall Differ CLI, follow these steps:
-
Download the Uninstallation Script: Download the uninstall script by running the following command in your terminal:
curl -L https://github.com/rostex/differ-cli/releases/download/v1.0.0/uninstall-getdiff.sh -o uninstall-getdiff.sh
-
Make the Script Executable: Change the permissions of the script to make it executable
chmod +x uninstall-getdiff.sh
-
Run the Uninstallation Script: Execute the script to uninstall the utility:
./uninstall-getdiff.sh
The script will:
- Remove the getdiff.jar file and command script.
- Delete the ~/.getdiff directory.
- Remove the installation directory from your PATH variable.
If you wish to uninstall Differ CLI, follow these steps:
-
Download the Uninstallation Script: Download the uninstallation script by running the following command in PowerShell:
Invoke-WebRequest -Uri "https://github.com/rostex/differ-cli/releases/download/v1.0.0/uninstall-getdiff.ps1" -OutFile "$env:USERPROFILE\Downloads\uninstall-getdiff.ps1"
-
Run the script as Administrator, just like the installation:
.\uninstall-getdiff.ps1
The script will:
- Remove the getdiff.jar file and command script.
- Delete the ~/.getdiff directory.
- Remove the installation directory from your PATH variable.