-
Notifications
You must be signed in to change notification settings - Fork 0
Command Line Reference
This is the complete reference for all Clean BOM Senior command-line options, flags, and parameters.
./clean-bom-senior.sh [OPTIONS] [PATH]| Argument | Type | Description | Example |
|---|---|---|---|
PATH |
Directory | Path to scan | /home/user/project |
All options are optional and can be combined:
# Single option
./clean-bom-senior.sh --dry-run /path
# Multiple options
./clean-bom-senior.sh --dry-run --verbose --backup /pathPreview changes without modifying files.
./clean-bom-senior.sh --dry-run /path/to/filesOutput:
[DRY-RUN] Scanning directory...
[BOM DETECTED] file1.php (UTF-8 BOM)
[BOM DETECTED] file2.json (UTF-8 BOM)
[NO CHANGES] file3.md
Total processed: 3
To be cleaned: 2
Use cases:
- Before running actual cleaning
- Check what will be modified
- Verify no unintended changes
Create backup copies with .bak extension.
./clean-bom-senior.sh --backup /path/to/filesResult:
original.php (cleaned)
original.php.bak (backup)
Use cases:
- Safety net for first-time use
- Preserve original versions
- Easy rollback if needed
Show detailed processing information.
./clean-bom-senior.sh --verbose /path/to/filesOutput includes:
- Every file processed
- BOM type detected
- Encoding changes
- Skip reasons
- Summary statistics
Use cases:
- Understand what happened
- Troubleshoot issues
- Monitor progress
Process only specific file type.
# Process only PHP files
./clean-bom-senior.sh --file-type php /path
# Process only JSON files
./clean-bom-senior.sh --file-type json /path
# Process only text files
./clean-bom-senior.sh --file-type text /pathSupported types:
-
php- PHP code -
python- Python code -
javascript- JavaScript code -
json- JSON data -
yaml- YAML config -
html- HTML pages -
css- CSS styles -
text- Plain text -
code- All code files -
data- All data files
Use cases:
- Target specific file type only
- Avoid processing unrelated files
- Type-specific cleaning rules
Skip specified directories.
# Skip one directory
./clean-bom-senior.sh --exclude vendor /path
# Skip multiple directories
./clean-bom-senior.sh --exclude vendor,node_modules,dist /pathCommon exclusions:
--exclude vendor,node_modules,dist,.git,buildUse cases:
- Skip third-party code (vendor, node_modules)
- Avoid build directories
- Exclude version control (.git)
- Skip temporary folders (dist, build)
Process directories recursively (default behavior).
./clean-bom-senior.sh --recursive /pathNote: This is the default behavior; rarely needed explicitly.
Process only files in top directory.
./clean-bom-senior.sh --no-recursive /pathUse cases:
- Process one directory only
- Avoid nested subdirectories
- Specific directory level targeting
Convert Windows CRLF to Unix LF.
./clean-bom-senior.sh --fix-crlf /path
# Fix both BOM and CRLF
./clean-bom-senior.sh --fix-crlf /pathConverts:
-
\r\n(CRLF - Windows) β\n(LF - Unix)
Use cases:
- Fix mixed line endings
- Prepare for Unix servers
- Standardize line endings
Force processing without confirmation.
./clean-bom-senior.sh --force /pathUse cases:
- Scripting/automation
- CI/CD pipelines
- Batch processing
Update .gitattributes file.
./clean-bom-senior.sh --fix-gitattributes /pathAdds:
* text eol=lf
*.php text eol=lf
*.js text eol=lf
Use cases:
- Prevent future CRLF issues in Git
- Standardize team line endings
- Enforce encoding standards
Save results to file.
./clean-bom-senior.sh --report results.txt /pathOutput format:
Clean BOM Senior - Processing Report
Date: 2025-01-20 14:30:00
Directory: /home/user/project
Files Processed: 47
BOM Removed: 12
CRLF Fixed: 5
Errors: 0
Detailed Results:
[CLEANED] index.php
[CLEANED] config.json
[SKIPPED] vendor/file.php (excluded)
Set logging level.
# Detailed logging
./clean-bom-senior.sh --log debug /path
# Normal logging
./clean-bom-senior.sh --log info /path
# Minimal logging
./clean-bom-senior.sh --log error /path./clean-bom-senior.sh --dry-run --verbose /pathResult: See exactly what will change, no modifications.
./clean-bom-senior.sh --backup --verbose /pathResult: Clean files, keep backups, show progress.
./clean-bom-senior.sh --file-type php /pathResult: Process only PHP files.
./clean-bom-senior.sh --fix-crlf /pathResult: Remove BOM and fix line endings.
./clean-bom-senior.sh --force --exclude vendor,node_modules --dry-run /pathResult: Check without changes, suitable for CI/CD gates.
Use exit codes in scripts:
| Code | Meaning | Action |
|---|---|---|
0 |
Success | Changes made |
1 |
No changes | Nothing to clean |
2 |
Errors | Check output |
3 |
Path not found | Verify path |
4 |
Permission denied | Check permissions |
Example in script:
./clean-bom-senior.sh /path
if [ $? -eq 0 ]; then
echo "BOM successfully cleaned!"
else
echo "No BOM found or error occurred"
fi-
Always dry-run first
./clean-bom-senior.sh --dry-run /path
-
Backup critical files
./clean-bom-senior.sh --backup /path
-
Use verbose for understanding
./clean-bom-senior.sh --verbose /path
-
Exclude vendor/node_modules
./clean-bom-senior.sh --exclude vendor,node_modules /path
-
Combine options
./clean-bom-senior.sh --dry-run --verbose --exclude vendor /path
Complete reference for all Clean BOM Senior commands and options.