https://github.com/marcuwynu23/treego
TreeGo is a cli tool for printing directory structures and searching files.
https://github.com/marcuwynu23/treego
dfs-algorithm file-structure-ascii-tree golang tree tree-structure
Last synced: about 2 months ago
JSON representation
TreeGo is a cli tool for printing directory structures and searching files.
- Host: GitHub
- URL: https://github.com/marcuwynu23/treego
- Owner: marcuwynu23
- Created: 2025-11-27T02:28:35.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-12-16T06:00:48.000Z (3 months ago)
- Last Synced: 2025-12-18T02:00:53.423Z (3 months ago)
- Topics: dfs-algorithm, file-structure-ascii-tree, golang, tree, tree-structure
- Language: Go
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
TreeGo
TreeGo is a fast, concurrent, and safe directory tree printer and file search tool written in Go. It allows you to print the directory structure, search for files, and filter results using regex patterns or directories-only mode.
---
## Features
- Print a visual directory tree.
- Search for files and directories by name.
- Filter files and directories using regex.
- Option to display directories only.
- Safe concurrent traversal with automatic error handling.
- Exits immediately if an error or deadlock is detected.
---
## Installation
1. Ensure you have [Go](https://golang.org/dl/) installed (1.20+ recommended).
2. Clone the repository:
```bash
git clone https://github.com/marcuwynu23/treego.git
cd treego
```
3. Build the binary:
```bash
go build -o treego main.go
```
4. Run the tool:
```bash
./treego [--search ] [--regex ] [--dirs-only]
```
---
## Usage
```text
treego [--search ] [--regex ] [--dirs-only] [--version]
```
### Flags
- `--search`, `-s` : Search string. Prints full path of matching files.
- `--regex`, `-r` : Regex filter to match file or directory names.
- `--dirs-only`, `-d` : Show only directories.
- `--version` : Show TreeGo version.
### Examples
Print the tree of a folder:
```bash
treego /path/to/project
```
Search for files containing `main`:
```bash
treego /path/to/project --search main
```
Show directories only:
```bash
treego /path/to/project --dirs-only
```
Use regex to filter names:
```bash
treego /path/to/project --regex "\.go$"
```
---
## Safety Features
- Uses a global abort channel to exit immediately on errors.
- Prevents deadlocks when traversing large directories.
- Concurrent processing of directories for faster traversal.
---