https://github.com/thesurlydev/flatten
A CLI tool to flatten nested project directories and files
https://github.com/thesurlydev/flatten
Last synced: 4 months ago
JSON representation
A CLI tool to flatten nested project directories and files
- Host: GitHub
- URL: https://github.com/thesurlydev/flatten
- Owner: thesurlydev
- License: mit
- Created: 2024-12-06T00:24:53.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-06T17:08:58.000Z (over 1 year ago)
- Last Synced: 2025-09-30T06:42:08.472Z (8 months ago)
- Language: Rust
- Size: 12.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# flatten-project
A Rust CLI tool that flattens nested project directories into a single directory with underscore-delimited filenames
while preserving the original structure.
## Features
- Preserves original project structure
- Respects `.gitignore` and `.flatignore` patterns
- Handles filename collisions automatically
- Processes hidden files
- Creates underscore-delimited filenames based on original paths
- Automatically removes existing 'flattened' directory if present
## Error Handling
- Validates directory existence
- Reports ignored files
- Shows detailed progress during processing
- Reports total number of processed files
## Installation
Clone the project and run:
```bash
cargo install --path .
```
## Usage
Run in the current directory:
```bash
flatten-project
```
Or specify a target directory:
```bash
flatten-project /path/to/project
```
## Example
Given this project structure:
```
my-project/
├── src/
│ ├── main.rs
│ └── utils/
│ ├── helpers.rs
│ └── config/
│ └── settings.rs
├── tests/
│ └── integration.rs
└── Cargo.toml
```
Running `flatten` will create:
```
my-project/
├── [original structure remains]
└── flattened/
├── src_main.rs
├── src_utils_helpers.rs
├── src_utils_config_settings.rs
├── tests_integration.rs
└── Cargo.toml
```
## Ignore Patterns
The tool respects both `.gitignore` and `.flatignore` files. Create a `.flatignore` file to specify additional patterns for files you don't want to include in the flattened output:
```gitignore
# .flatignore
Cargo.lock
*.tmp
build/
```