This is a utility for merging code files within a local directory into a single text file.
Examples:
Merge files in the current directory:
combine .
# Creates a file named after the input directory with a .txt extension
Merge files in the src
directory, including only Python and JavaScript files. Save as merged.txt
:
combine src -o merged.txt -e py,js
To get the tool on your system, follow these steps:
- Clone the repository:
git clone https://github.com/aistudiodev/codebase2file.git
- Navigate to the directory:
cd codebase2file
- Run the script:
python main.py <directory> [options]
For other operating systems, feel free to modify the installation script to suit your OS.
Run the installation script:
python install.py
This adds the combine
command to your terminal. Restart your terminal for the changes to take effect.
combine <directory> [options]
directory
: The directory to process. Use.
to indicate the current directory.
-o
,--output
: (Optional) The path to the output file. If not specified, the output file will be named after the processed directory with a.txt
extension and saved within the same directory.-e
,--extensions
: (Optional) A comma-separated list of file extensions to include (without the dot). For example,py,js,html
.
- The tool automatically excludes files and directories specified in
.gitignore
and the.git
directory.
- Inspired by github2file by @cognitivecomputations
If you encounter issues, please create an issue on the GitHub repository.