Code-map is a utility designed for recursively searching files in a directory and merging them into a single file with markup. It is useful for project documentation, report creation, and combining the contents of source code or other files into one markdown file.
- Recursively traverses all nested directories.
- Filters files based on a specified pattern (regular expression).
- Generates a
project.md
file with the contents of the found files wrapped in markdown format.
./code-map ~/Develop/sandbox "\\.(go|json)\$"
After execution, a project.md file will be created with the contents of the project.
path
— the path to the directory where the recursive search should be performed.pattern
— a regular expression for filtering files by name.
Ensure that Go (version 1.23 and above) is installed.
-
Clone the repository:
git clone https://github.com/your-repository/project-tree.git
-
Navigate to the project directory:
cd project-tree
-
Build the utility:
go build -o project-tree
Suppose you have the following project structure:
project/
├── cmd/
│ └── main.go
├── internal/
│ ├── configs/
│ │ └── configs.go
│ └── repository/
│ └── postgresql.go
Contents of the files:
cmd/main.go:
package main
func main() {
// some logic
}
internal/configs/configs.go:
package configs
func someConfigFN() {
// some logic
}
internal/repository/postgresql.go:
package repository
func someRepositoryFN() {
// some logic
}