Skip to content

Commit 7654949

Browse files
authored
Gh 6 add content transformation options (#31)
* code cleaner implementation and updated readme * chore: fixed tests * chore: added more tests tests
1 parent e890182 commit 7654949

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+5858
-369
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,7 @@ __debug_bin
4040
# Build directory
4141
build/
4242
dist/
43-
coverage/
43+
coverage/
44+
coverage.txt
45+
coverage.xml
46+
coverage.html

README.md

Lines changed: 109 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ FileFusion is a powerful command-line tool designed to concatenate and process f
1111
- Powerful file pattern matching and exclusion
1212
- Concurrent file processing for better performance
1313
- Size limits for both individual files and total output
14+
- Detailed size reporting (uncompressed and final sizes with --clean)
1415
- Preserves file metadata and structure
1516
- Safe file handling with atomic writes
1617
- Cross-platform compatibility
@@ -178,8 +179,28 @@ filefusion --max-file-size 20MB /path/to/project
178179
# Increase total output size limit to 100MB
179180
filefusion --max-output-size 100MB /path/to/project
180181

181-
# Set both limits
182-
filefusion --max-file-size 20MB --max-output-size 100MB /path/to/project
182+
# Set both limits and enable cleaning to see size reduction
183+
filefusion --max-file-size 20MB --max-output-size 100MB --clean /path/to/project
184+
```
185+
186+
When using the `--clean` flag, FileFusion will show both:
187+
188+
- The uncompressed size (before cleaning)
189+
- The final size (after cleaning)
190+
191+
Example output with `--clean`:
192+
193+
```
194+
Processing /path/to/project:
195+
Found 10 files matching pattern
196+
Uncompressed size: 1.2MB
197+
Final size (with --clean): will be calculated after processing
198+
199+
Matched files:
200+
- src/main.go (500KB)
201+
- src/utils.go (700KB)
202+
203+
Final size (with --clean): 800KB
183204
```
184205

185206
Size limits accept suffixes:
@@ -236,6 +257,92 @@ filefusion \
236257
/path/to/project
237258
```
238259

260+
### Code Cleaning and Size Optimization
261+
262+
```bash
263+
# Clean and optimize a Go project
264+
filefusion \
265+
--pattern "*.go" \
266+
--exclude "*_test.go" \
267+
--clean \
268+
--clean-remove-comments \
269+
--clean-remove-logging \
270+
--output optimized.xml \
271+
/path/to/go/project
272+
273+
# Clean TypeScript/JavaScript with preserved documentation
274+
filefusion \
275+
--pattern "*.ts,*.js" \
276+
--clean \
277+
--clean-preserve-doc-comments \
278+
--clean-remove-logging \
279+
--clean-optimize-whitespace \
280+
--output web-optimized.xml \
281+
/path/to/web/project
282+
283+
# Maximum cleaning for size reduction
284+
filefusion \
285+
--pattern "*.go,*.js,*.py" \
286+
--clean \
287+
--clean-remove-comments \
288+
--clean-remove-imports \
289+
--clean-remove-logging \
290+
--clean-remove-getters-setters \
291+
--clean-optimize-whitespace \
292+
--clean-remove-empty-lines \
293+
--output minimal-size.xml \
294+
/path/to/project
295+
296+
# Clean with size monitoring
297+
filefusion \
298+
--pattern "*.{go,js,py,java}" \
299+
--clean \
300+
--clean-remove-comments \
301+
--clean-optimize-whitespace \
302+
--max-file-size 20MB \
303+
--max-output-size 100MB \
304+
--output monitored-clean.xml \
305+
/path/to/project
306+
```
307+
308+
### Combining Features
309+
310+
```bash
311+
# Clean code and monitor size in multiple directories
312+
filefusion \
313+
--pattern "*.{go,js,ts}" \
314+
--exclude "**/{test,tests,vendor}/**" \
315+
--clean \
316+
--clean-remove-comments \
317+
--clean-preserve-doc-comments \
318+
--clean-optimize-whitespace \
319+
/path/to/project1 /path/to/project2
320+
321+
# Process large codebase with size optimization
322+
filefusion \
323+
--pattern "*.{go,js,ts,py,java,cpp,h}" \
324+
--exclude "**/{test,build,dist,vendor}/**" \
325+
--clean \
326+
--clean-remove-comments \
327+
--clean-optimize-whitespace \
328+
--max-file-size 50MB \
329+
--max-output-size 500MB \
330+
--output large-project.xml \
331+
/path/to/large/project
332+
333+
# Documentation-preserving clean with size monitoring
334+
filefusion \
335+
--pattern "*.{go,js,py}" \
336+
--exclude "**/vendor/**" \
337+
--clean \
338+
--clean-preserve-doc-comments \
339+
--clean-remove-logging \
340+
--clean-optimize-whitespace \
341+
--max-file-size 10MB \
342+
--output docs-preserved.xml \
343+
/path/to/project
344+
```
345+
239346
## Output Format Examples
240347

241348
### XML Output Structure

0 commit comments

Comments
 (0)