fcom (short for file_combiner) is a versatile Rust CLI tool designed to process folders and files, combining their contents into a single output file. It offers a range of features for file manipulation and directory analysis.
- Combine multiple files into a single output file
- Generate folder tree structures
- Create file lists
- Support for custom output formats (XML, Markdown, or custom templates)
- Option to add line numbers to file contents
- Ignore specific folders and filter by file extensions
- Rust and Cargo (Install from https://www.rust-lang.org/tools/install)
-
Clone the repository:
git clone https://github.com/pabl-o-ce/fcom.git
-
Navigate to the project directory:
cd fcom
-
Build and install the binary:
cargo install --path .
This will install the fcom
binary in your Cargo bin directory.
fcom provides three main commands:
combine
: Combines multiple files into a single output filetree
: Generates a folder tree structurelist
: Creates a list of files in a folder
fcom combine <FOLDER_PATH> [OPTIONS]
Options:
--output <FILE>
: Specify the output file (default: output.txt)--extensions <EXTENSIONS>...
: Specify file extensions to include--ignore <FOLDERS>...
: Specify folders to ignore (default: .git,node_modules,pycache)--add-line-numbers
: Add line numbers to file contents--mode <MODE>
: Specify the output mode (xml, markdown, or custom) (default: xml)--custom-output-template <FILE>
: Specify a custom output template file (required for custom mode)--custom-file-template <FILE>
: Specify a custom file template file (required for custom mode)
fcom tree <FOLDER_PATH> [OPTIONS]
Options:
--output <FILE>
: Specify the output file (default: folder_tree.txt)--extensions <EXTENSIONS>...
: Specify file extensions to include--ignore <FOLDERS>...
: Specify folders to ignore (default: .git,node_modules,pycache)
fcom list <FOLDER_PATH> [OPTIONS]
Options:
--output <FILE>
: Specify the output file (default: file_list.txt)--extensions <EXTENSIONS>...
: Specify file extensions to include--ignore <FOLDERS>...
: Specify folders to ignore (default: .git,node_modules,pycache)
fcom combine /path/to/your/folder --output combined_output.txt --mode xml
fcom tree /path/to/your/folder --output folder_tree.txt
fcom list /path/to/your/folder --output file_list.txt
fcom combine /path/to/your/folder --output combined_output.md --mode markdown --add-line-numbers
fcom combine /path/to/your/folder --output custom_output.txt --mode custom --custom-output-template /path/to/output_template.txt --custom-file-template /path/to/file_template.txt
This project was inspired by Maximilian-Winter's file_combiner. We appreciate their work and the ideas it provided for this implementation.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.