gdiff

command module
v0.0.0-...-0d6f639 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: MIT Imports: 11 Imported by: 0

README ΒΆ

gdiff

Glam Diff - A beautiful terminal diff viewer built with Charm libraries.

Go Version License

Features

  • 🎨 Beautiful TUI - Built with Bubble Tea and Lip Gloss
  • πŸ” Smart Diff - Structural diffing with intelligent alignment
  • 🎯 Dual View Modes - Toggle between unified and side-by-side views
  • ⌨️ Vim-style Navigation - Intuitive keyboard shortcuts
  • 🎨 Toggleable Syntax Highlighting - Color-coded additions (green), deletions (red), and modifications (orange/yellow)
  • βš™οΈ Configurable - Extensible architecture for customization
  • πŸ“Š Inline Statistics Panel - Quick access to diff statistics without leaving the main view
  • πŸ’‘ Contextual Help Panel - In-place help display for easy reference

Installation

From Source
git clone https://github.com/cj3636/gdiff.git
cd gdiff
make build

Or manually:

go build -o gdiff .
Using Go Install
go install github.com/cj3636/gdiff@latest
Using Make Targets
make help     # Show all available commands
make build    # Build the application
make install  # Install to $GOPATH/bin
make clean    # Remove build artifacts
make fmt      # Format code
make test     # Run tests

Usage

Basic Usage
gdiff file1.txt file2.txt
Command-Line Options
gdiff [options] <file1> <file2>

Options:
  -h, --help              Show help information
  -v, --version           Show version information
  -n, --no-line-numbers   Hide line numbers
  -t, --tab-size int      Set tab size (default 4)
Examples
# Compare two text files
gdiff old.txt new.txt

# Compare without line numbers
gdiff -n config1.json config2.json

# Compare with custom tab size
gdiff -t 2 code1.go code2.go

Keyboard Shortcuts

Key Action
j / ↓ Scroll down one line
k / ↑ Scroll up one line
d Scroll half page down
u Scroll half page up
g Go to top
G Go to bottom
v Toggle side-by-side view
c Toggle syntax highlighting
s Toggle statistics panel
? / h Toggle help panel
q / ^C Quit

Architecture

The project is organized for extensibility and maintainability:

gdiff/
β”œβ”€β”€ main.go              # Entry point with CLI handling
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ config/          # Configuration system
β”‚   β”œβ”€β”€ diff/            # Diff engine with multiple algorithms
β”‚   └── tui/             # Terminal UI components
β”œβ”€β”€ go.mod
└── README.md
Key Components
  • Diff Engine (internal/diff): Handles file comparison using intelligent algorithms
  • TUI Layer (internal/tui): Bubble Tea model for interactive display
  • Config System (internal/config): Flexible configuration with themes

Comparison with Difftastic

gdiff is inspired by difftastic and aims to provide:

  • βœ… Beautiful terminal UI with Charm libraries
  • βœ… Easy-to-use interface with intuitive navigation
  • βœ… Extensible architecture for future enhancements
  • βœ… Side-by-side diff view
  • βœ… Color-coded changes
  • 🚧 Structural/syntax-aware diffing (planned)
  • 🚧 Language detection (planned)
  • 🚧 Git integration (planned)

Future Enhancements

This is the foundation for a full TUI for managing and viewing local git repositories. Planned features include:

  • Syntax-aware structural diffing
  • Language detection and specific highlighting
  • Git repository integration
  • Interactive staging/unstaging
  • Multiple file comparison
  • Custom theme configuration
  • Plugin system for extensibility

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - See LICENSE file for details.

Acknowledgments

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Directories ΒΆ

Path Synopsis
internal
tui

Jump to

Keyboard shortcuts

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