← 返回
未分类 中文

Jrv Text Diff

Compare two text files or strings side-by-side or unified. Highlights additions, deletions, and changes with color. Supports word-level diff, ignore-whitespa...
对比文件或字符串,高亮增删改,支持逐词比较和忽略空白。
johnnywang2001 johnnywang2001 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 421
下载
💾 0
安装
1
版本
#latest

概述

jrv-text-diff

Compare two texts, files, or code snippets and show exactly what changed. Supports unified diff, side-by-side view, word-level highlighting, and structural diff for JSON/YAML.

Quick Start

# Compare two files
python3 scripts/text_diff.py file1.txt file2.txt

# Compare inline strings
python3 scripts/text_diff.py --text "hello world" --text2 "hello there"

# Unified diff (patch format)
python3 scripts/text_diff.py file1.txt file2.txt --format unified

# Side-by-side comparison
python3 scripts/text_diff.py file1.txt file2.txt --format side-by-side

# Word-level diff
python3 scripts/text_diff.py file1.txt file2.txt --word-diff

# Ignore whitespace
python3 scripts/text_diff.py file1.txt file2.txt --ignore-whitespace

# JSON structural diff
python3 scripts/text_diff.py data1.json data2.json --format json

# YAML structural diff
python3 scripts/text_diff.py config1.yaml config2.yaml --format yaml

# Output diff as JSON report
python3 scripts/text_diff.py file1.txt file2.txt --output-json

Commands

CommandDescription
----------------------
text_diff.py Compare two files (default: unified diff)
--text --text2 Compare two inline strings
--format unifiedUnified patch-style diff output
--format side-by-sideTwo-column comparison
--format contextContext diff (like diff -c)
--format jsonStructural JSON diff
--format yamlStructural YAML diff
--word-diffHighlight word-level changes within lines
--ignore-whitespaceIgnore leading/trailing whitespace
--ignore-caseCase-insensitive comparison
--context NLines of context (default: 3)
--output-jsonOutput diff stats as JSON
--no-colorDisable ANSI color output

Use Cases

  • Code review: See exactly what changed between two versions of a config or script
  • Config auditing: Spot differences between prod and staging configs
  • JSON/YAML diffs: Structural comparison ignoring key ordering
  • Copy editing: Word-level diff for prose documents
  • CI pipelines: JSON output for programmatic diff analysis

Exit Codes

  • 0 — Files are identical
  • 1 — Files differ
  • 2 — Error (file not found, parse error, etc.)

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-30 21:29 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

business-ops

Agent Invoice Generator

johnnywang2001
根据自然语言或结构化数据生成专业的PDF发票,适用于用户请求创建发票、向客户计费或生成收据等场景。
★ 0 📥 746
dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 197 📥 67,975
dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 681 📥 329,547