differ

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2026 License: MIT Imports: 3 Imported by: 0

README

Differ

Go

Overview

A small command-line utility for comparing two configuration files and showing the differences between them.

Features

  • Supports JSON and YAML files
  • Supports both absolute and relative file paths
  • Outputs differences in three formats: stylish, plain, and JSON
  • Can be used as a library from Go code

Installation

You can install the application using Go:

go install github.com/CosmoS1X/differ/cmd/differ@latest

You can also download a precompiled binary from the releases page.

Usage

differ <file1> <file2>

Optional flags:

By default, the output format is stylish.

The format flag supports both short and long forms:

differ --format stylish <file1> <file2>
differ -f plain <file1> <file2>
differ -f json <file1> <file2>

Library usage

The package can also be used as a Go library. Import the package and call the diff function:

import "github.com/CosmoS1X/differ"

result, err := differ.Gen("file1.json", "file2.json", "stylish")

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Gen

func Gen(path1, path2, format string) (string, error)

Gen compares two configuration files and returns the formatted diff.

It parses both input files, builds a diff tree, and formats the result according to the provided output format.

Types

This section is empty.

Directories

Path Synopsis
cmd
differ command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL