cmp

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CmpJSONResult

type CmpJSONResult struct {
	File1     string `json:"file1"`
	File2     string `json:"file2"`
	Identical bool   `json:"identical"`
	DiffByte  int64  `json:"diffByte,omitempty"`
	DiffLine  int64  `json:"diffLine,omitempty"`
	Byte1     byte   `json:"byte1,omitempty"`
	Byte2     byte   `json:"byte2,omitempty"`
	EOF       string `json:"eof,omitempty"`
}

CmpJSONResult represents the JSON output for cmp

type CmpOptions

type CmpOptions struct {
	Silent     bool  // -s: suppress all output
	Verbose    bool  // -l: output byte numbers and values
	PrintBytes bool  // -b: print differing bytes
	SkipBytes1 int64 // -i SKIP1: skip first SKIP1 bytes of FILE1
	SkipBytes2 int64 // -i SKIP2: skip first SKIP2 bytes of FILE2
	MaxBytes   int64 // -n LIMIT: compare at most LIMIT bytes
	JSON       bool  // --json: output as JSON
}

CmpOptions configures the cmp command behavior

type CmpResult

type CmpResult int

CmpResult represents the result of comparison

const (
	CmpEqual  CmpResult = 0
	CmpDiffer CmpResult = 1
	CmpError  CmpResult = 2
)

func RunCmp

func RunCmp(w io.Writer, args []string, opts CmpOptions) (CmpResult, error)

RunCmp compares two files byte by byte

Jump to

Keyboard shortcuts

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