docs(readme): document --preserve-lines flag and indentation safety
This commit is contained in:
@@ -38,6 +38,9 @@ shush script.sh --dry-run
|
|||||||
# Create a backup before modifying
|
# Create a backup before modifying
|
||||||
shush config.lua --backup
|
shush config.lua --backup
|
||||||
|
|
||||||
|
# Keep comment-only lines as empty lines (indentation always preserved)
|
||||||
|
shush script.py --preserve-lines
|
||||||
|
|
||||||
# Verbose output
|
# Verbose output
|
||||||
shush app.go --verbose
|
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
|
--dry-run Show what would be removed without making changes
|
||||||
--backup Create backup files before modification
|
--backup Create backup files before modification
|
||||||
--verbose Show detailed output
|
--verbose Show detailed output
|
||||||
|
--preserve-lines Keep comment-only lines as empty lines (indentation always preserved)
|
||||||
|
|
||||||
# Git-aware flags
|
# Git-aware flags
|
||||||
--changes-only Remove comments only from git changes (staged + unstaged + untracked)
|
--changes-only Remove comments only from git changes (staged + unstaged + untracked)
|
||||||
@@ -114,11 +118,19 @@ shush src/ --recursive --inline --dry-run --verbose
|
|||||||
# Before
|
# Before
|
||||||
# This is a comment
|
# This is a comment
|
||||||
def hello():
|
def hello():
|
||||||
|
# Comment-only line
|
||||||
print("Hello") # Inline comment
|
print("Hello") # Inline comment
|
||||||
|
|
||||||
# After running: shush example.py
|
# After running: shush example.py (default - comment-only lines deleted)
|
||||||
def hello():
|
def hello():
|
||||||
print("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
|
### JavaScript
|
||||||
@@ -158,6 +170,18 @@ shush --staged # 2. Clean staged changes
|
|||||||
git commit -m "Clean code" # 3. Commit cleaned code
|
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
|
### Backup and Preview
|
||||||
```bash
|
```bash
|
||||||
# Always create backup before modifying
|
# Always create backup before modifying
|
||||||
|
|||||||
Reference in New Issue
Block a user