What's Taco? ๐ฎ ยท In Action ๐ถ๏ธ ยท Why Taco? ๐ค ยท Features โจ ยท Project Structure ๐ ยท Getting Started ๐ ยท Arguments ๐ ยท How to Use Taco ๐ฎ ยท Pro Tips ๐ก ยท Makefile Commands ๐ ๏ธ ยท Examples ๐ ยท Limitations
Taco is a simple tool that gathers all text files from a directory and its subdirectories, combining them into one file. Ideal for preparing source code or text content for use as prompts with large language models (LLMs), Taco streamlines the process, saving time by automating file gathering.
- ๐๏ธ Efficient Aggregation: Automatically collects large numbers of text files.
- โฑ๏ธ Saves Time: Eliminates manual copying, enhancing workflow.
- ๐ก๏ธ Reduces Errors: Minimizes inconsistencies and mistakes.
- ๐ค LLM Integration: Ideal for creating data-rich prompts.
- ๐ Simplifies Documentation: Compiles documentation and source code.
- ๐ Boosts Productivity: Streamlines tasks to enhance efficiency.
- ๐ฎ Automatic Gathering: Collects text files from specified directories and subdirectories.
- ๐ Recursive Processing: Seamlessly handles all nested directories.
- ๐ Flexible Directory and File Selection: Customizable file and directory filters.
- ๐ซ Skip Hidden and Binary Files: Keeps output clean.
- ๐ Detailed Status Updates: Displays progress and skips details.
- ๐ Append Mode: Adds to existing files without overwriting.
- โจ Customizable Output: Set custom output names and locations.
- ๐ฏ Include/Exclude Files by Pattern: Include or exclude files matching specific patterns or regular expressions.
/taco
โโโ go.mod # Go module file
โโโ Makefile # Makefile to simplify commands
โโโ src # Directory containing the source code
โ โโโ main.go # Main Go file
โ โโโ main_test.go # Main Go Test file
-
Navigate to the Releases Page.
-
Download the Latest Release for Linux.
-
Make the Binary Executable:
chmod +x taco
-
Move the Binary to
/usr/local/bin/:sudo mv taco /usr/local/bin/
-
Clone the Repository:
git clone https://github.com/lucianoayres/taco.git cd taco -
Initialize the Go Module:
go mod tidy
-
Build Taco:
make build
-
Install Taco:
sudo make install
After setting up Taco, you can run it in one of the following ways:
If you downloaded the binary or built it yourself, you can run Taco directly by simply typing:
tacoThis will execute the binary from anywhere if itโs located in your systemโs PATH (e.g., /usr/local/bin/). Alternatively, if the binary is in your current directory, you can run:
./tacoTo run Taco directly from the source without building, navigate to the projectโs root directory and use:
go run ./srcThis command will execute the Taco code in the src directory, bypassing the need to build the binary first.
Use these optional flags to customize how Taco processes your files:
-
-output- Specifies the output file name (default:
taco.txt).
- Specifies the output file name (default:
-
-include-ext- Specify file extensions to include (e.g.,
.go,.md).
- Specify file extensions to include (e.g.,
-
-exclude-ext- Specify file extensions to exclude (e.g.,
.test,.spec.js).
- Specify file extensions to exclude (e.g.,
-
-include-dir- Include specific directories for processing.
-
-exclude-dir- Exclude root-level directories from processing.
-
-include-file-pattern- Include files matching specific patterns or regular expressions (e.g.,
^main\.go$).
- Include files matching specific patterns or regular expressions (e.g.,
-
-exclude-file-pattern- Exclude files matching specific patterns or regular expressions (e.g.,
.*_test\.go$,^LICENSE$).
- Exclude files matching specific patterns or regular expressions (e.g.,
-
-verbose- Enables verbose output for detailed status messages.
-
Precedence: When both
-include-extand-exclude-extare used, Taco first filters files by-include-ext, then excludes any files that match-exclude-ext. The same applies to-include-dirand-exclude-dir. -
Extension Format: Taco automatically prepends a dot if missing.
-
Pattern Matching: The
-include-file-patternand-exclude-file-patternflags use regular expressions for pattern matching. Ensure patterns are valid and properly escaped.
Run Taco without arguments to concatenate all text files in the current directory and its subdirectories (excluding hidden and binary files):
taco-
Include specific directories: Use
-include-dirto process only specified directories. If omitted, Taco processes all subdirectories in the current directory.taco -include-dir=src,docs
-
Exclude specific directories: Use
-exclude-dirto skip certain directories. For instance, to skipvendorandtests:taco -exclude-dir=vendor,tests
Note: The
-exclude-dirflag applies only to root-level directories of the specified path.
Choose files by extension using these flags:
-
Include specific file types: Use
-include-extto focus on particular file types, such as.goand.md.taco -include-ext=.go,.md
-
Exclude certain file types: Use
-exclude-extto omit specific extensions, like.logand.tmp.taco -exclude-ext=.log,.tmp
Tip: Taco first filters files by
-include-ext, then removes those matching-exclude-ext, if both are specified.
Use the -include-file-pattern and -exclude-file-pattern flags to include or exclude files matching specific patterns or regular expressions.
-
Include files matching patterns:
taco -include-file-pattern="^main\.go$,^README\.md$" -
Exclude files matching patterns:
taco -exclude-file-pattern=".*_test\.go$,.*\.bak$"
Note: Patterns are regular expressions. Ensure they are properly quoted and escaped.
Combine flags to refine file selection. For example:
taco -output=my-taco.txt -include-dir=src,docs -exclude-dir=vendor,tests -include-ext=.go,.md -exclude-ext=.log,.tmp -include-file-pattern="^main\.go$,^README\.md$" -exclude-file-pattern=".*_test\.go$,^Makefile$,^LICENSE$"This command combines .go and .md files from src and docs, excludes vendor and tests, includes files matching ^main\.go$ and ^README\.md$, excludes .log and .tmp files, and excludes files matching the specified patterns.
- Recursive Processing: Taco traverses all subdirectories.
- Only Text Files: Includes files based on content.
- Custom Output: Set output file with
-output. - Include/Exclude Specific Extensions: Use
-include-extor-exclude-ext. - Exclude Directories: Use
-exclude-dirto omit directories. - Include/Exclude Files by Pattern: Use
-include-file-patternand-exclude-file-patternfor fine-grained file selection. - Append Mode: Appends new content to the existing output file if it already exists.
- Detailed Status: Verbose mode for skip reasons.
Simplify Taco usage with these Makefile commands:
- Run Taco:
make run - Build Taco:
make build - Install Taco:
sudo make install - Clean Build Files:
make clean - Uninstall Taco:
sudo make uninstall - Run Tests:
make test - Run Tests with Coverage:
make test-coverage - Generate HTML Coverage Report:
make coverage-html
-
Concatenate Text Files in Current Directory:
taco
-
Custom Output Filename:
taco -output=my-files.txt
-
Specify Directories:
taco -output=my-taco.txt -include-dir=src,docs
-
Include Only Go and Markdown Files:
taco -include-ext=.go,.md
-
Exclude Specific Extensions:
taco -exclude-ext=.test,.spec.js
-
Include Files Matching Patterns:
taco -include-file-pattern="^main\.go$,^README\.md$" -
Exclude Files Matching Patterns:
taco -exclude-file-pattern=".*_test\.go$,^Makefile$,^LICENSE$" -
Exclude Directories and Set Custom Output:
taco -output=final.txt -exclude-dir=vendor,tests -include-dir=src,docs -include-ext=.py,.md -exclude-ext=.log,.tmp -include-file-pattern="^app\.py$" -exclude-file-pattern=".*_test\.py$"
- Binary Files Excluded: Binary files are automatically excluded.
- Hidden Files Skipped: Files/directories starting with a dot are skipped.
- File Extension Detection: Relies on extensions for inclusion/exclusion.
- Pattern Matching: Inclusion and exclusion by pattern use regular expressions, which require valid syntax.
- Conflict Handling: When using both inclusion and exclusion arguments, overlapping criteria may need careful management.
- Launch v1.0
- Implement
-include-extfeature (Completed) - Implement
-exclude-extfeature (Completed) - Implement
-exclude-dirfeature (Completed) - Implement
-include-dirfeature (Completed) - Add regex-based filename exclusion (
-exclude-file-pattern) (Completed) - Add regex-based filename inclusion (
-include-file-pattern) (Completed) - Support for
.gitignorefiles - Enhanced error handling and logging
Found a bug or have a feature request? Open an issue or create a pull request on GitHub. Let's make Taco even better!
This project is licensed under the MIT License. Enjoy your tacos responsibly!

