Examplesο
Here are comprehensive examples showing PTβs capabilities.
1. Quick Note Takingο
# Copy meeting notes to clipboard, then:
pt notes.txt -m "Meeting notes from sprint planning"
Output:
β
Successfully written to: notes.txt
π Content size: 142 characters
π¬ Comment: "Meeting notes from sprint planning"
2. Version Control for Codeο
# Before making risky changes
pt main.go -m "Working version before refactoring"
# π¦ Backup created: main_go.20251118_141241...
# π¬ Comment: "Working version before refactoring"
# After changes (only saves if different)
pt main.go -c -m "Refactored authentication module"
# π Content differs, proceeding with backup and write
# β
Successfully written to: main.go
# View version history with comments
pt -l main.go
3. Configuration Managementο
# Save production config
pt config.json -m "Production config for v2.1.0 release"
# Later, update for testing
pt config.json -m "Testing new cache settings"
# View all config versions with comments
pt -l config.json
Output:
ββββββββββββββ¬ββββββββββββββ¬βββββββ¬βββββββββββββββββββββββββββββ
β File Name β Modified β Size β Comment β
ββββββββββββββΌββββββββββββββΌβββββββΌβββββββββββββββββββββββββββββ€
β 1. config..β 14:12:41 β 2 KB β Testing new cache settings β
β 2. config..β 10:30:15 β 2 KB β Production config v2.1.0 β
ββββββββββββββ΄ββββββββββββββ΄βββββββ΄βββββββββββββββββββββββββββββ
# Restore production config
pt -r config.json --last -m "Reverting to production config"
4. Check Mode - Save Disk Spaceο
# Only write if content actually changed
pt data.json -c
# βΉοΈ Content identical to current file, no changes needed
# π File: data.json
# Or with comment if it does change
pt data.json -c -m "Updated user preferences"
# π Content differs, proceeding with backup and write
# π¦ Backup created with comment
5. Safe Delete with Contextο
# Delete old implementation with explanation
pt -rm legacy_auth.py -m "Replaced by new OAuth2 implementation"
Output:
π¦ Backup created: legacy_auth_py.20251118_141241...
π¬ Comment: "Replaced by new OAuth2 implementation"
ποΈ File deleted: legacy_auth.py
π Created empty placeholder: legacy_auth.py
6. Append Mode with Commentsο
# Append log entries with context
pt + errors.log -m "Error logs from production incident"
Output:
β
Successfully appended to: errors.log
π Content size: 87 characters
π¬ Comment: "Error logs from production incident"
7. Interactive Restoreο
pt -r main.go
Output:
π Backup files for 'main.go'
Total: 5 backup(s) (stored in .pt/)
ββββββββββββββββββββββββββββ¬ββββββββββββββββββββββ¬βββββββββββ¬βββββββββββββββββββββββββββββββββ
β File Name β Modified β Size β Comment β
ββββββββββββββββββββββββββββΌββββββββββββββββββββββΌβββββββββββΌβββββββββββββββββββββββββββββββββ€
β 1. main_go.20251118... β 2025-11-18 14:12:41 β 50.5 KB β Add comment system β
β 2. main_go.20251118... β 2025-11-18 14:11:24 β 57.0 KB β Working version before refactorβ
β 3. main_go.20251118... β 2025-11-18 13:43:01 β 52.6 KB β Fixed authentication bug β
β 4. main_go.20251113... β 2025-11-13 11:47:02 β 49.2 KB β - β
β 5. main_go.20251113... β 2025-11-13 11:39:49 β 49.2 KB β - β
ββββββββββββββββββββββββββββ΄ββββββββββββββββββββββ΄βββββββββββ΄βββββββββββββββββββββββββββββββββ
Enter backup number to restore (1-5) or 0 to cancel: 2
β
Successfully restored: main.go
π¦ From backup: main_go.20251118_141124...
π¬ Restore comment: "Restored from backup"
8. Configuration File Setupο
# Create configuration file
pt config init
# Edit pt.yml
cat > pt.yml << EOF
# PT Configuration File
max_clipboard_size: 104857600 # 100MB
max_backup_count: 100 # Keep 100 backups
max_filename_length: 200 # Max filename length
backup_dir_name: .pt # Git-like directory
max_search_depth: 10 # Max recursive search depth
EOF
# View current config
pt config show
Output:
Current PT Configuration:
Max Clipboard Size: 104857600 bytes (100.0 MB)
Max Backup Count: 100
Max Filename Length: 200 characters
Backup Directory: .pt/ (Git-like structure)
Max Search Depth: 10 levels
Config loaded from: ./pt.yml
9. Recursive File Searchο
# File not in current directory? PT finds it automatically!
pt config.json
Output:
π Searching for 'config.json' in subdirectories...
β Found at: /path/to/project/src/config.json
Multiple files found:
π Found 3 matching file(s)
ββββββββ¬βββββββββββββββββββββββββββββ¬ββββββββββββββββββββββ¬βββββββββββββββ
β # β Path β Modified β Size β
ββββββββΌβββββββββββββββββββββββββββββΌββββββββββββββββββββββΌβββββββββββββββ€
β 1 β ./config.json β 2025-11-15 10:30:00 β 2.1 KB β
β 2 β ./src/config.json β 2025-11-14 15:20:00 β 1.8 KB β
β 3 β ./examples/config.json β 2025-11-13 09:15:00 β 1.2 KB β
ββββββββ΄βββββββββββββββββββββββββββββ΄ββββββββββββββββββββββ΄βββββββββββββββ
Enter file number to use (1-3) or 0 to cancel: 1
β Using: ./config.json
10. Visual Diff Comparisonο
# Interactive diff - choose which backup to compare
pt -d main.go
# Quick diff with last backup
pt -d main.go --last
Output:
π Comparing with last backup: main_go.20251115_151804...
Current file: /path/to/main.go
Backup file: /path/to/.pt/main_go/main_go.20251115_151804...
[Beautiful colored diff output from delta]
11. Move recursive/treeο
C:\TEMP\test-pt>tree2
π C:\TEMP\test-pt/
βββ π .gitignore (27.00 B)
βββ π dest/
βββ π dest_new/
βββ π test1.go (130.30 KB)
βββ π test2.go (130.30 KB)
βββ π test3.go (130.30 KB)
C:\TEMP\test-pt>pt move *.go dest
π― Matched 3 file(s) from patterns
π Moving 3 file(s) with backup adjustment...
Destination: C:\TEMP\test-pt\dest
Type: Directory
[1/3] Processing: test1.go
π¦ Found 2 backup(s)
π Using existing .pt from: .pt/ β
Moved backups (2 metadata updated)
β
Moved to: C:\TEMP\test-pt\dest\test1.go
[2/3] Processing: test2.go
π¦ Found 1 backup(s)
π Using existing .pt from: .pt/ β
Moved backups (1 metadata updated)
β
Moved to: C:\TEMP\test-pt\dest\test2.go
[3/3] Processing: test3.go
π¦ Found 1 backup(s)
π Using existing .pt from: .pt/ β
Moved backups (1 metadata updated)
β
Moved to: C:\TEMP\test-pt\dest\test3.go
π Move Summary:
β
3 file(s) moved successfully
π¦ 4 backup(s) adjusted
C:\TEMP\test-pt>ls
.gitignore .pt\ dest\ dest_new\
C:\TEMP\test-pt>pt -l test1.go
π Searching for 'test1.go' in subdirectories...
β Found: C:\TEMP\test-pt\dest\test1.go
π Backup files for 'C:\TEMP\test-pt\dest\test1.go'
Total: 2 backup(s) (stored in .pt/)
ββββββββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββ¬βββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β File Name β Modified β Size β Comment β
ββββββββββββββββββββββββββββββββββββββββββββΌββββββββββββββββββββββΌβββββββββββββββΌβββββββββββββββββββββββββββββββββ€
β 1. test1_go.20251202_150950668211.3... β 2025-12-02 15:09:50 β 130.3 KB β Restored from last backup β
β 2. test1_go.20251202_150836676759.3... β 2025-12-02 15:08:36 β 130.3 KB β - β
ββββββββββββββββββββββββββββββββββββββββββββ΄ββββββββββββββββββββββ΄βββββββββββββββ΄βββββββββββββββββββββββββββββββββ
C:\TEMP\test-pt>move dest dest_new
1 dir(s) moved.
C:\TEMP\test-pt>pt -l test1.go
π Searching for 'test1.go' in subdirectories...
β Found: C:\TEMP\test-pt\dest_new\dest\test1.go
βΉοΈ No backups found for: C:\TEMP\test-pt\dest_new\dest\test1.go (check .pt/ directory)
12. Fix structure/treeο
C:\TEMP\test-pt>pt fix
π Scanning for orphaned backups...
π Using .pt directory: C:\TEMP\test-pt\.pt
β οΈ Found 4 orphaned backup(s):
[1] Orphaned backup: dest_main.go
Expected: C:\TEMP\test-pt\dest\main.go (NOT FOUND)
No matches found (file may be deleted)
[2] Orphaned backup: dest_test1.go
Expected: C:\TEMP\test-pt\dest\test1.go (NOT FOUND)
Possible matches found:
1) dest_new\dest\test1.go
[3] Orphaned backup: dest_test2.go
Expected: C:\TEMP\test-pt\dest\test2.go (NOT FOUND)
Possible matches found:
1) dest_new\dest\test2.go
[4] Orphaned backup: dest_test3.go
Expected: C:\TEMP\test-pt\dest\test3.go (NOT FOUND)
Possible matches found:
1) dest_new\dest\test3.go
Options:
1. Auto-fix: Update backup references for files with single match
2. Manual: Select correct file for each orphaned backup
3. Clean: Remove orphaned backups (files deleted)
0. Cancel
Choice: 1
β
Fixed: test1.go -> test1.go
β
Fixed: test2.go -> test2.go
β
Fixed: test3.go -> test3.go
π Result: 3 fixed, 1 skipped
C:\TEMP\test-pt>pt -l test1.go
π Searching for 'test1.go' in subdirectories...
β Found: C:\TEMP\test-pt\dest_new\dest\test1.go
π Backup files for 'C:\TEMP\test-pt\dest_new\dest\test1.go'
Total: 2 backup(s) (stored in .pt/)
ββββββββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββ¬βββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β File Name β Modified β Size β Comment β
ββββββββββββββββββββββββββββββββββββββββββββΌββββββββββββββββββββββΌβββββββββββββββΌβββββββββββββββββββββββββββββββββ€
β 1. test1_go.20251202_150950668211.3... β 2025-12-02 15:09:50 β 130.3 KB β Restored from last backup β
β 2. test1_go.20251202_150836676759.3... β 2025-12-02 15:08:36 β 130.3 KB β - β
ββββββββββββββββββββββββββββββββββββββββββββ΄ββββββββββββββββββββββ΄βββββββββββββββ΄βββββββββββββββββββββββββββββββββ
C:\TEMP\test-pt>tree2
π C:\TEMP\test-pt/
βββ π .gitignore (27.00 B)
βββ π dest_new/
βββ π dest/
βββ π test1.go (130.30 KB)
βββ π test2.go (130.30 KB)
βββ π test3.go (130.30 KB)
13. Directory Tree Visualizationο
# Show current directory tree
pt -t
Output:
myproject/
βββ src/
β βββ main.go (15.2 KB) [modified]
β βββ utils.go (3.4 KB)
βββ .pt/
β βββ main_go/
β β βββ main_go.20251115_151804...
β βββ utils_go/
β βββ utils_go.20251115_143022...
βββ README.md (2.1 KB)
βββ go.mod (456 B)
2 directories, 5 files, 29.2 KB total
Exclude specific folders:
pt -t -e node_modules,.git,dist,build
14. Complete Workflow Exampleο
Daily development session:
# Start work, check status
pt check
# Make changes to files
# ... edit main.go ...
# Backup specific file with comment
pt main.go -m "Added user authentication"
# Commit all changes at end of day
pt commit -m "Implemented auth module and updated tests"
# Review what changed
pt -l main.go
pt -d main.go --last
# Next day: continue working...