Code Aggregator
Code Aggregator is a command-line tool that scans a specified directory and aggregates the contents of files with specific types into an output file.
Installation
To install Code Aggregator, run the following command:
npm install -g CodeAggregator
After installation, CodeAggregator
will be available to use in any package.
Usage
You can use the Code Aggregator tool with the following command-line options:
- -d, --directory: Directory to scan (default: './').
- -t, --fileTypes: File types to include (default: ['.js', '.html']).
- -o, --output: Output file name (default: 'dirContents.txt').
Example
To scan the current directory for JavaScript and HTML files and output the contents to a file named myOutput.txt
, run the following command:
CodeAggregator --directory ./ --fileTypes .js .html --output myOutput.txt
Help
You can access the help menu for more information by running:
CodeAggregator --help
Code Overview
The code utilizes the fs
, path
, and yargs
modules to read the directory and file content, filter by file type, and write the aggregated content to the specified output file.