Featuresο
Core Featuresο
π Quick Saveο
Write clipboard content to file with one command:
pt myfile.txt
Automatic backup is created if file exists.
π¦ Auto Backupο
Automatic timestamped backups stored in .pt/ directory (Git-like structure). Each backup includes:
Microsecond-precision timestamp
Process ID
Random ID for zero-collision guarantee
Optional comment
Backup format:
filename_ext.YYYYMMDD_HHMMSS_MICROSECONDS.PID_RANDOMID
π¬ Backup Commentsο
Add descriptive comments to track why changes were made:
pt main.go -m "Fixed authentication bug"
Comments are stored in .meta.json files alongside backups.
β Append Modeο
Add content without creating backups:
pt + myfile.txt
Useful for logs or accumulating content.
π Restoreο
Interactive or quick restore from backups:
pt -r myfile.txt # Interactive selection
pt -r myfile.txt --last # Restore most recent
Restore with comment:
pt -r myfile.txt --last -m "Emergency rollback"
π Beautiful Listingsο
Formatted table view of all backups with sizes, timestamps, and comments:
pt -l myfile.txt
Output:
ββββββββββββββββββββββββββββ¬ββββββββββββββββββββββ¬βββββββββββ¬βββββββββββββββββββββββββββββββββ
β File Name β Modified β Size β Comment β
ββββββββββββββββββββββββββββΌββββββββββββββββββββββΌβββββββββββΌβββββββββββββββββββββββββββββββββ€
β 1. main_go.20251118... β 2025-11-18 14:12:41 β 50.5 KB β Fixed auth bug β
β 2. main_go.20251118... β 2025-11-18 14:11:24 β 57.0 KB β Working version before refactorβ
ββββββββββββββββββββββββββββ΄ββββββββββββββββββββββ΄βββββββββββ΄βββββββββββββββββββββββββββββββββ
π Production Hardenedο
Path validation:
Prevents path traversal attacks (
../../../etc/passwd)Blocks writes to system directories (
/etc,/sys,C:\Windows)Validates filename length limits
Sanitizes all file paths
Size limits:
Maximum 100MB clipboard content (configurable)
Prevents disk exhaustion attacks
Validates disk space before writing
Safe operations:
Atomic-like file operations
Verification of write completion
Automatic rollback on errors
Backup before destructive operations
π¨ Colorful Outputο
ANSI colors for better readability:
Green : Success, unchanged files
Yellow : Warnings, modified files
Cyan : Info, new files
Red : Errors, deleted files
Blue : Search operations
π Audit Loggingο
All operations logged to stderr for tracking:
pt myfile.txt -m "Test"
Log output:
2025-11-18 14:12:41 Successfully written to: myfile.txt (1234 bytes)
Use --debug for verbose logging:
pt --debug myfile.txt
β Check Modeο
Skip writes if content unchanged (saves disk space):
pt data.json -c
Output if identical:
βΉοΈ Content identical to current file, no changes needed
π File: data.json
Output if different:
π Content differs, proceeding with backup and write
Advanced Featuresο
π Recursive File Searchο
Automatically finds files in subdirectories up to 10 levels deep:
pt config.json # Finds it anywhere in project
If multiple files found, interactive selection:
π Found 3 matching file(s)
ββββββββ¬βββββββββββββββββββββββββββββ¬ββββββββββββββββββββββ¬βββββββββββββββ
β # β Path β Modified β Size β
ββββββββΌβββββββββββββββββββββββββββββΌββββββββββββββββββββββΌβββββββββββββββ€
β 1 β ./README.md β 2025-11-15 10:30:00 β 15.2 KB β
β 2 β ./docs/README.md β 2025-11-14 15:20:00 β 8.5 KB β
ββββββββ΄βββββββββββββββββββββββββββββ΄ββββββββββββββββββββββ΄βββββββββββββββ
Enter file number to use (1-3) or 0 to cancel: 1
Search respects:
.gitignorepatterns.ptignorepatterns (PT-specific, higher priority)Excludes
.pt/directory automatically
π Delta Diff Integrationο
Beautiful side-by-side diff comparison with backups:
pt -d myfile.txt # Interactive: choose backup
pt -d myfile.txt --last # Quick: compare with last
Requires Delta to be installed.
Diff clipboard with file (no backup):
pt -d myfile.txt -z
π³ Directory Tree Viewο
Visual file structure with sizes (like tree command):
pt -t # Current directory
pt -t /path/to/dir # Specific directory
Output:
myproject/
βββ src/
β βββ main.go (15.2 KB)
β βββ utils.go (3.4 KB)
βββ .pt/
β βββ ... (backup files)
βββ README.md (2.1 KB)
βββ go.mod (456 B)
2 directories, 5 files, 29.2 KB total
Tree with exceptions:
pt -t -e node_modules,.git,dist
π GitIgnore Supportο
Respects .gitignore patterns in tree view and recursive search.
ποΈ Safe Deleteο
Backup before deletion, create empty placeholder:
pt -rm old_file.txt
Output:
π¦ Backup created: old_file_txt.20251118_141241...
ποΈ File deleted: old_file.txt
π Created empty placeholder: old_file.txt
Use with comment:
pt -rm legacy_auth.py -m "Replaced by new OAuth2 implementation"
βοΈ Exception Filteringο
Exclude specific files/folders from tree view:
pt -t /path -e build,dist,node_modules
π― Multi-File Selectionο
Interactive prompt when multiple files found during recursive search.
π Smart Path Resolutionο
Finds files anywhere in your project, automatically searching upward for .pt directory.
βοΈ Configurableο
Customize behavior via pt.yml config file:
max_clipboard_size: 104857600
max_backup_count: 100
max_filename_length: 200
backup_dir_name: .pt
max_search_depth: 10
Version Management Capabilitiesο
PT acts as a lightweight version control system with descriptive comments:
π Complete Version Historyο
Every file change is preserved with optional comments.
π Contextual Notesο
Add meaningful descriptions to each backup:
pt main.go -m "Fixed race condition in goroutine"
π Easy Rollbackο
Restore any previous version instantly, see why it was saved:
pt -r main.go --last
π Version Comparisonο
Diff any two versions visually with delta:
pt -d main.go --last
πΎ Space Efficientο
Only changed files are backed up (check mode).
π·οΈ Timestamped Versionsο
Microsecond precision timestamps + human-readable comments.
Zero Data Lossο
Never lose work:
Automatic backup before every write
Backup before deletion
Atomic-like operations
Verification of write completion
Performanceο
Operation |
Performance |
Notes |
|---|---|---|
Startup Time |
< 50ms |
Very fast startup |
Write Speed |
Disk I/O limited |
Depends on storage |
Memory Usage |
~5MB + content |
Minimal footprint |
Backup Creation |
< 100ms |
For typical files |
Search Speed |
< 200ms |
For 1000+ files |
Multi-file Search |
< 500ms |
Up to 10 levels deep |
Tree Generation |
< 500ms |
5000+ files/folders |
Diff Rendering |
Depends on delta |
Powered by delta |
π¬ Comment Systemο
Track why changes were made, not just when: