A complete command-line tool for working with txtar format archives, supporting packing, unpacking, listing, and comparing operations with Git integration.
Features
- pack: Pack directories or Git changesets into txtar format
- unpack: Safely unpack txtar archives to filesystem
- list: List files in a txtar archive
- diff: Compare two archives or directory with archive
Installation
go install github.com/phlv/txtar@latest
Or build from source:
git clone https://github.com/phlv/txtar.git
cd txtar
go build -o txtar
Usage
Pack
Pack a directory into txtar format:
txtar pack --exclude "*.log" -o archive.txtar
Pack with Git integration:
txtar pack --git --since=1 -o delta.txtar
Pack staged changes:
txtar pack --git --staged -o staged.txtar
Unpack
Unpack with backup:
txtar unpack --backup --dir /output archive.txtar
Dry-run to preview operations:
txtar unpack --dry-run archive.txtar
List
List archive contents:
txtar list archive.txtar
From stdin:
cat archive.txtar | txtar list
Diff
Compare two archives:
txtar diff left.txtar right.txtar
Compare directory with archive:
txtar diff --dir ./src archive.txtar
Configuration
Create ~/.config/txtar/config.yaml:
pack:
default_exclude:
- "*.log"
- "node_modules/"
- ".git/"
ignore_binary: true
unpack:
backup: false
dir: "./out"
Examples
See .config.yaml.example and .txtarignore.example for configuration examples.
Testing
go test ./...
License
MIT