docs(readme): document --preserve-lines flag and indentation safety

This commit is contained in:
carraes
2025-07-06 11:21:24 -03:00
parent 70a2dd7612
commit d4295b4329
+25 -1
View File
@@ -38,6 +38,9 @@ shush script.sh --dry-run
# Create a backup before modifying
shush config.lua --backup
# Keep comment-only lines as empty lines (indentation always preserved)
shush script.py --preserve-lines
# Verbose output
shush app.go --verbose
@@ -84,6 +87,7 @@ shush src/ --recursive --inline --dry-run --verbose
--dry-run Show what would be removed without making changes
--backup Create backup files before modification
--verbose Show detailed output
--preserve-lines Keep comment-only lines as empty lines (indentation always preserved)
# Git-aware flags
--changes-only Remove comments only from git changes (staged + unstaged + untracked)
@@ -114,11 +118,19 @@ shush src/ --recursive --inline --dry-run --verbose
# Before
# This is a comment
def hello():
# Comment-only line
print("Hello") # Inline comment
# After running: shush example.py
# After running: shush example.py (default - comment-only lines deleted)
def hello():
print("Hello")
# After running: shush example.py --preserve-lines (comment-only lines kept as empty)
def hello():
print("Hello")
# Note: Code indentation is ALWAYS preserved in both modes
```
### JavaScript
@@ -158,6 +170,18 @@ shush --staged # 2. Clean staged changes
git commit -m "Clean code" # 3. Commit cleaned code
```
### Line Structure Control
```bash
# Default: Comment-only lines are deleted entirely
shush script.py # Clean removal
# Keep comment-only lines as empty lines (preserves line numbers)
shush script.py --preserve-lines # Useful for debugging/line references
# Code indentation is ALWAYS preserved regardless of flag
shush python_code.py --preserve-lines --dry-run
```
### Backup and Preview
```bash
# Always create backup before modifying