Skip to content

Commit

Permalink
added testcov badge
Browse files Browse the repository at this point in the history
  • Loading branch information
drgsn committed Dec 22, 2024
1 parent 57cb92e commit 9ca322a
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# FileFusion

FileFusion is a powerful file concatenation tool designed specifically for Large Language Model (LLM) applications.
It combines multiple files into a single structured output file while preserving metadata
[![Test Coverage](https://codecov.io/gh/drgsn/filefusion/branch/main/graph/badge.svg)](https://codecov.io/gh/drgsn/filefusion)

FileFusion is a powerful file concatenation tool designed specifically for Large Language Model (LLM) applications.
It combines multiple files into a single structured output file while preserving metadata
and maintaining a format that's optimal for LLM processing.

## Features
Expand Down Expand Up @@ -30,7 +32,7 @@ filefusion [flags]

- `-i, --input`: Input directory path (default: current directory)
- `-o, --output`: Output file path (default: output.xml)
- `-p, --pattern`: Comma-separated file patterns (default: "*.go,*.json,*.yaml,*.yml")
- `-p, --pattern`: Comma-separated file patterns (default: "_.go,_.json,_.yaml,_.yml")
- `-e, --exclude`: Comma-separated patterns to exclude
- `--max-size`: Maximum size of the output file (default: 10MB)

Expand All @@ -39,45 +41,53 @@ filefusion [flags]
### Basic Usage

1. Process all Go files in the current directory:

```bash
filefusion -p "*.go"
```

2. Process multiple file types:

```bash
filefusion -p "*.go,*.js,*.py" -o output.xml
```

3. Process files from a specific directory:

```bash
filefusion -i /path/to/project -p "*.go"
```

### Output Formats

1. Generate XML output (default):

```bash
filefusion -p "*.go" -o output.xml
```

2. Generate JSON output:

```bash
filefusion -p "*.go" -o output.json
```

3. Generate YAML output:

```bash
filefusion -p "*.go" -o output.yaml
```

### File Size Limits

1. Set a 5MB limit for the output file:

```bash
filefusion -p "*.go" --max-size 5MB
```

2. Use different size units:

```bash
filefusion -p "*.go" --max-size 500KB
filefusion -p "*.go" --max-size 1GB
Expand All @@ -86,29 +96,33 @@ filefusion -p "*.go" --max-size 1GB
### Exclusion Patterns

1. Exclude specific directories:

```bash
filefusion -p "*.go" -e "vendor/**,build/**"
```

2. Exclude specific files:

```bash
filefusion -p "*.go" -e "*_test.go"
```

3. Complex exclusion patterns:

```bash
filefusion -p "*.go,*.js" -e "vendor/**,**/*_test.go,**/node_modules/**"
```

## Output Format Examples

### XML Output

```xml
<documents>
<document index="1">
<source>main.go</source>
<document_content>package main

func main() {
// ...
}</document_content>
Expand All @@ -118,6 +132,7 @@ func main() {
```

### JSON Output

```json
{
"documents": [
Expand All @@ -131,13 +146,14 @@ func main() {
```

### YAML Output

```yaml
documents:
- index: 1
source: main.go
document_content: |
package main
func main() {
// ...
}
Expand All @@ -146,13 +162,15 @@ documents:
## Size Units
The `--max-size` flag supports the following units:

- B (Bytes)
- KB (Kilobytes)
- MB (Megabytes)
- GB (Gigabytes)
- TB (Terabytes)

Examples:

- `--max-size 500B`
- `--max-size 1KB`
- `--max-size 10MB`
Expand All @@ -161,6 +179,7 @@ Examples:
## File Pattern Syntax

FileFusion uses standard glob patterns:

- `*`: Matches any sequence of characters except path separators
- `**`: Matches any sequence of characters including path separators (for directory exclusions)
- `?`: Matches any single character
Expand All @@ -170,6 +189,7 @@ FileFusion uses standard glob patterns:
## Error Handling

FileFusion provides clear error messages for common issues:

- File size exceeding limits
- Invalid patterns
- Missing files
Expand All @@ -178,4 +198,4 @@ FileFusion provides clear error messages for common issues:

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.
Contributions are welcome! Please feel free to submit a Pull Request.

0 comments on commit 9ca322a

Please sign in to comment.