DiFi is a CLI (command line interface) tool that enables you to reuse your previous written feature in a brown/new project(s) by cleaning up project-related details (like package statements) and write the cleaned content to your project directory.
- Open and read any file
- Filter file content by skipping a specified number of initial lines don't needed
- Write filtered content to a target directory with the same filename
Note: you should check about permissions on read & write to the file you are trying to reuse.
DiFi/
├── cmd/
│ └── main/
│ └── main.go # Entry point of the application
├── internal/
│ └── combiner/
│ └── projectCombiner.go # Core logic
├── go.mod # Go module definition
└── README.md
- Clone the repo:
git clone https://github.com/ABAlosaimi/DiFi- Build the project:
go build -o difi ./cmd/mainRun the compiled binary or use go run:
go run main.go <filePath> <filteringStartLineNum> <projectDir>Note: You must be in the main directory
filePath: Absolute path to the file you want to filterfilteringStartLineNum: Number of lines to skip from the beginning of the file (0-indexed)projectDir: The target directory where the filtered file will be written
go run main.go "/path/to/input.txt" 5 "/path/to/output/dir"The workflow will be:
- Open
/path/to/input.txt - Skip the first 5 lines
- Write the remaining content to
/path/to/output/dir/input.txt
Skip header rows in CSV or text files before processing:
difi data.csv 1 ./processedRemove boilerplate or template headers from code files:
difi template.go 10 ./srcRemove initial metadata or timestamps from log files:
difi app.log 3 ./clean-logsDiFi operates in three main steps:
- Open: Reads the source file from the specified path
- Filter: Scans the file line-by-line and skips the specified number of initial lines
- Write: Creates a new file in the target directory with the filtered content
- Go 1.16 or higher
Claude code, reviewed by eng.Abdulrahman F. Alosaimi