|
1 | | -# drift README |
| 1 | +# drift |
2 | 2 |
|
3 | | -Congrats, project leads! You got a new project to grow! |
| 3 | +<p align="center"> |
| 4 | + <img src=".github/assets/drift_logo.png" alt="Drift logo" width="700"> |
| 5 | +</p> |
4 | 6 |
|
5 | | -This stub is meant to help you form a strong community around your work. It's yours to adapt, and may |
6 | | -diverge from this initial structure. Just keep the files seeded in this repo, and the rest is yours to evolve! |
| 7 | +A **fast**, **interactive** file **comparison tool**. |
7 | 8 |
|
8 | | -## Introduction |
| 9 | +Compare directories, archives, binaries, plists, and text files with a terminal UI or structured JSON output. |
9 | 10 |
|
10 | | -Orient users to the project here. This is a good place to start with an assumption |
11 | | -that the user knows very little - so start with the Big Picture and show how this |
12 | | -project fits into it. |
| 11 | +## Installation |
13 | 12 |
|
14 | | -Then maybe a dive into what this project does. |
| 13 | +```sh |
| 14 | +go install github.com/block/drift/cmd/drift@latest |
| 15 | +``` |
15 | 16 |
|
16 | | -Diagrams and other visuals are helpful here. Perhaps code snippets showing usage. |
| 17 | +Or [download a pre-built binary for your platform from a release](https://github.com/block/drift/releases) |
17 | 18 |
|
18 | | -Project leads should complete, alongside this `README`: |
| 19 | +Or build from source: |
19 | 20 |
|
20 | | -* [CODEOWNERS](./CODEOWNERS) - set project lead(s) |
21 | | -* [CONTRIBUTING.md](./CONTRIBUTING.md) - Fill out how to: install prereqs, build, test, run, access CI, chat, discuss, file issues |
22 | | -* [Bug-report.md](.github/ISSUE_TEMPLATE/bug-report.md) - Fill out `Assignees` add codeowners @names |
23 | | -* [config.yml](.github/ISSUE_TEMPLATE/config.yml) - remove "(/add your discord channel..)" and replace the url with your Discord channel if applicable |
| 21 | +```sh |
| 22 | +gh repo clone block/drift |
| 23 | +cd drift |
| 24 | +go run ./cmd/drift --help |
| 25 | +``` |
24 | 26 |
|
25 | | -The other files in this template repo may be used as-is: |
| 27 | +## Usage |
26 | 28 |
|
27 | | -* [GOVERNANCE.md](./GOVERNANCE.md) |
28 | | -* [LICENSE](./LICENSE) |
| 29 | +```sh |
| 30 | +# Compare two directories |
| 31 | +drift path/a path/b |
29 | 32 |
|
30 | | -## Project Resources |
| 33 | +# Compare two archives (.ipa, .apk, .aar, .jar, .tar.gz, .tar.bz2) |
| 34 | +drift app-v1.ipa app-v2.ipa |
31 | 35 |
|
32 | | -| Resource | Description | |
33 | | -| ------------------------------------------ | ------------------------------------------------------------------------------ | |
34 | | -| [CODEOWNERS](./CODEOWNERS) | Outlines the project lead(s) | |
35 | | -| [GOVERNANCE.md](./GOVERNANCE.md) | Project governance | |
36 | | -| [LICENSE](./LICENSE) | Apache License, Version 2.0 | |
| 36 | +# Compare two binaries |
| 37 | +drift bin-v1 bin-v2 |
| 38 | + |
| 39 | +# Force a specific comparison mode |
| 40 | +drift -m binary lib-v1.dylib lib-v2.dylib |
| 41 | + |
| 42 | +# JSON output (non-interactive, for scripting) |
| 43 | +drift --json path/a path/b |
| 44 | +``` |
| 45 | + |
| 46 | +### Comparison modes |
| 47 | + |
| 48 | +drift auto-detects the comparison mode based on the inputs: |
| 49 | + |
| 50 | +| Mode | Inputs | What it shows | |
| 51 | +|------|--------|---------------| |
| 52 | +| **tree** | Directories, archives | File tree with added/removed/modified indicators, per-file diffs | |
| 53 | +| **binary** | Mach-O binaries | Sections, sizes, symbols, load commands. Requires `nm` and `size` | |
| 54 | +| **plist** | Property lists (.plist) | Structured key-value diff. Binary plists require `plutil` | |
| 55 | +| **text** | Everything else | Line-by-line unified diff | |
| 56 | + |
| 57 | +Use `-m <mode>` to override auto-detection. |
| 58 | + |
| 59 | +### Archives |
| 60 | + |
| 61 | +drift transparently extracts and compares the contents of: |
| 62 | +- `.ipa` (iOS app bundles) |
| 63 | +- `.apk` (Android app bundles) |
| 64 | +- `.aar` (Android libraries) |
| 65 | +- `.jar` (Java archives) |
| 66 | +- `.tar`, `.tar.gz` / `.tgz`, `.tar.bz2` |
| 67 | + |
| 68 | +## Interactive TUI |
| 69 | + |
| 70 | +When stdout is a terminal, drift launches an interactive Bubbletea-based TUI with a split-pane layout: file tree on the left, detail diff on the right. |
| 71 | + |
| 72 | +### Keybindings |
| 73 | + |
| 74 | +| Key | Action | |
| 75 | +|-----|--------| |
| 76 | +| `↑`/`k`, `↓`/`j` | Navigate tree | |
| 77 | +| `→`/`enter`/`l` | Expand node | |
| 78 | +| `←`/`h` | Collapse node | |
| 79 | +| `tab` | Switch pane focus | |
| 80 | +| `n`/`N` | Next/previous change | |
| 81 | +| `f` | Cycle filter (all → added → removed → modified) | |
| 82 | +| `1`-`4` | Filter: all, added, removed, modified | |
| 83 | +| `/` | Search (fuzzy match in tree, text search in detail) | |
| 84 | +| `s` | Swap A ↔ B | |
| 85 | +| `c` | Copy detail to clipboard | |
| 86 | +| `pgup`/`pgdn` | Scroll detail pane | |
| 87 | +| `g`/`G` | Jump to top/bottom | |
| 88 | +| `?` | Toggle full help | |
| 89 | +| `q`/`ctrl+c` | Quit | |
| 90 | + |
| 91 | +## JSON output |
| 92 | + |
| 93 | +Pass `--json` to get structured JSON output suitable for scripting and CI pipelines. For tree mode, the output is the full comparison result. For single-file modes (binary, plist, text), the output includes both the summary and the detailed diff. |
| 94 | + |
| 95 | +## Platform support |
| 96 | + |
| 97 | +drift works on **macOS**, **Linux**, and **Windows**. Core features (directory/archive comparison, text diffing) work everywhere. Some features require external tools and degrade gracefully when they are unavailable: |
| 98 | + |
| 99 | +| Tool | Used for | Availability | |
| 100 | +| --- | --- | --- | |
| 101 | +| `nm`, `size` | Mach-O binary analysis | macOS (Xcode CLI Tools), Linux (binutils) | |
| 102 | +| `plutil` | Binary plist conversion | macOS only (XML plists work everywhere) | |
| 103 | +| `xclip` or `xsel` | Clipboard | Linux only (macOS and Windows work natively) | |
| 104 | + |
| 105 | +## License |
| 106 | + |
| 107 | +[Apache License 2.0](LICENSE) |
0 commit comments