{"id":27725193,"url":"https://github.com/shiquda/treex","last_synced_at":"2025-07-20T08:05:58.363Z","repository":{"id":287213484,"uuid":"963969000","full_name":"shiquda/treex","owner":"shiquda","description":"🌳❌: Treex is a CLI for directory structure visualization in various formats with powerful filters.","archived":false,"fork":false,"pushed_at":"2025-05-16T09:22:26.000Z","size":102,"stargazers_count":134,"open_issues_count":2,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-10T05:05:33.870Z","etag":null,"topics":["cli","command-line-tool","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shiquda.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-10T13:43:46.000Z","updated_at":"2025-06-09T09:29:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"3075e911-7b27-4939-b558-ac0573f6da56","html_url":"https://github.com/shiquda/treex","commit_stats":null,"previous_names":["shiquda/treex"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/shiquda/treex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiquda%2Ftreex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiquda%2Ftreex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiquda%2Ftreex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiquda%2Ftreex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shiquda","download_url":"https://codeload.github.com/shiquda/treex/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiquda%2Ftreex/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266087790,"owners_count":23874519,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","command-line-tool","golang"],"created_at":"2025-04-27T19:01:19.135Z","updated_at":"2025-07-20T08:05:58.351Z","avatar_url":"https://github.com/shiquda.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# 🌳❌ Treex\n\n[![Go Version](https://img.shields.io/badge/Go-1.22+-00ADD8?style=flat\u0026logo=go)](https://golang.org)\n[![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\n[![Release](https://img.shields.io/github/v/release/shiquda/treex?include_prereleases)](https://github.com/shiquda/treex/releases)\n[![Go Report Card](https://goreportcard.com/badge/github.com/shiquda/treex)](https://goreportcard.com/report/github.com/shiquda/treex)\n\n![Treex](/docs/img/treex.png)\n\n[简体中文](/docs/README_zh-cn.md)\n\nTreex is a powerful command-line tool for displaying directory structures in different formats. It offers **multiple output formats** and **flexible filtering options**, making it easy to visualize and explore your project layout.\n\n## ✨ Features\n\n- 🎨 Multiple output formats:\n  - 🌲 `tree`: Tree format (default)\n  - 📑 `indent`: Indented list format\n  - 📝 `md`: Markdown format\n  - 📊 `mermaid`: Mermaid format\n- 🔍 Flexible filtering options:\n  - 🕵️ `-H`: Hide hidden files and directories\n  - 📁 `-D`: Show directories only\n  - 🚫 `-e \u003crules\u003e`: Exclude specific directories or file extensions\n  - 📝 `-I`: Automatically apply .gitignore rules\n- 🛠️ Customizable output:\n  - 📏 `-m \u003cdepth\u003e`: Control directory depth\n  - 💾 `-o \u003cpath\u003e`: Save output to a file\n  - 🎯 `-f \u003cformat\u003e`: Select output format\n  - ⭐ `-C`: Show icons for files (via emoji)\n\n## 📦 Installation\n\nDownload the pre-built binary from the [releases](https://github.com/shiquda/treex/releases) page and add it to your PATH.\n\nOr, if you want to build it yourself with Go:\n\n```bash\ngo install github.com/shiquda/treex@latest\n```\n\nFor windows user, you can use [scoop](https://scoop.sh/scoop) to install treex:\n\n```bash\nscoop bucket add extras\nscoop install treex\n```\n\n## 📖 Usage\n\nBasic usage:\n\n```bash\ntreex -d \u003cdirectory\u003e\n```\n\nTo generate a tree for the current directory, simply run:\n\n```bash\ntreex\n```\n\n### ⚙️ Full Options\n\nYou can run `treex -h` to see the help message.\n\nAll command-line options are listed in the table below:\n\n| Short Option | Long Option    | Argument            | Description                                                                 | Default Value |\n|--------------|----------------|---------------------|-----------------------------------------------------------------------------|---------------|\n| `-d`         | `--dir`        | `\u003cdirectory\u003e`       | Directory to scan                                                           | `.`           |\n| `-f`         | `--format`     | `\u003cformat\u003e`          | Output format (`tree`, `indent`, `md`, `mermaid`)                           | `tree`        |\n| `-m`         | `--max-depth`  | `\u003cnumber\u003e`          | Maximum directory depth (0 for unlimited)                                  | -             |\n| `-o`         | `--output`     | `\u003cfilepath\u003e`        | Path to output file                                                         | stdout        |\n| `-e`         | `--exclude`    | `\u003crules\u003e`           | Exclude rules (comma-separated: `dir/` for dirs, `.ext` for extensions)     | -             |\n| `-H`         | `--hide-hidden` | -                   | Hide hidden files and directories                                           | false         |\n| `-D`         | `--dirs-only`  | -                   | Show directories only                                                       | false         |\n| `-I`         | `--use-gitignore` | -                 | Exclude files/directories based on `.gitignore`                              | false         |\n| `-C`         | `--icons`      | -                   | Show file type icons                                                        | false         |\n\nFormat options details:\n\n- `tree`: Tree structure with branches\n- `indent`: Indented list format\n- `md`: Markdown format\n- `mermaid`: Mermaid format for diagrams\n\nExclude rules format:\n\n- `dir/`: Exclude directories matching the specified name\n- `.ext`: Exclude files with the specified extension\n\n## 📚 Examples\n\nThe following examples use the same directory structure.\n\n1. Without hidden files, save output as markdown format:\n\n```bash\ntreex -H -f md -o structure.md\n```\n\n- `-H`: Hide hidden files and directories\n- `-f md`: Output in Markdown format\n- `-o structure.md`: Save output to structure.md file\n\n\u003cdetails\u003e\n\n\u003csummary\u003eResult:\u003c/summary\u003e\n\nThen in `./structure.md`:\n\n```markdown\n- ./\n  - 1.go\n  - 2.go\n  - README.md\n  - build/\n    - win/\n      - output.exe\n  - test/\n    - 3.go\n    - README_test.md\n```\n\n\u003c/details\u003e\n\n2. Use .gitignore rules to exclude files:\n\n`.gitignore`:\n\n```text\nbuild/\n```\n\nRun:\n\n```bash\ntreex -IH\n```\n\n- `-I`: Exclude files/directories based on `.gitignore`\n- `-H`: Hide hidden files and directories\n\nThis will automatically read the `.gitignore` file in the current directory and exclude matching files and directories.\n\n\u003cdetails\u003e\n\n\u003csummary\u003eResult:\u003c/summary\u003e\n\n```text\n.\n├── 1.go\n├── 2.go\n├── README.md\n└── test\n    ├── 3.go\n    └── README_test.md\n```\n\n\u003c/details\u003e\n\n3. Generate mermaid diagram for visible directories only:\n\n```bash\ntreex -HD -f mermaid\n```\n\n- `-H`: Hide hidden files and directories\n- `-D`: Show directories only\n- `-f mermaid`: Output in Mermaid diagram format\n\n\u003cdetails\u003e\n\n\u003csummary\u003eResult:\u003c/summary\u003e\n\n```mermaid\ngraph TD\n    N1[./]\n    N2[build/]\n    N1 --\u003e N2\n    N3[win/]\n    N2 --\u003e N3\n    N4[test/]\n    N1 --\u003e N4\n```\n\n\u003c/details\u003e\n\n4. Exclude specific directories or extensions:\n\n```bash\ntreex -e \".git/, .md\"\n```\n\n- `-e \".git/, .md\"`: Exclude `.git` directory and files with `.md` extension\n\n\u003cdetails\u003e\n\n\u003csummary\u003eResult:\u003c/summary\u003e\n\n```text\n.\n├── .gitignore\n├── 1.go\n├── 2.go\n├── build\n│   └── win\n│       └── output.exe\n└── test\n    └── 3.go\n```\n\n\u003c/details\u003e\n\n5. Show files up to depth 2 in indent mode:\n\n```bash\ntreex -m 2 -f indent\n```\n\n- `-m 2`: Show files up to depth 2\n- `-f indent`: Output in indented list format\n\n\u003cdetails\u003e\n\n\u003csummary\u003eResult:\u003c/summary\u003e\n\n```text\n./\n    .git/\n        HEAD\n        config\n        description\n        hooks/\n        info/\n        objects/\n        refs/\n    .gitignore\n    1.go\n    2.go\n    README.md\n    build/\n        win/\n    test/\n        3.go\n        README_test.md\n```\n\n\u003c/details\u003e\n\n6. Display the file structure with icons (using a real project structure as an example):\n\n```bash\ntreex -CHI -m 3\n```\n\n- `-C`: Show file type icons\n- `-H`: Hide hidden files and directories\n- `-I`: Exclude files/directories based on `.gitignore`\n- `-m 3`: Show files up to depth 3\n\n\u003cdetails\u003e\n\n\u003csummary\u003eResult:\u003c/summary\u003e\n\n```text\n📁 ./\n├── 📝 CODE_OF_CONDUCT.md\n├── 📝 CONTRIBUTING.md\n├── 📄 LICENSE\n├── 📝 README.md\n├── 📁 build/\n│   ├── 📄 entitlements.mac.plist\n│   ├── 📄 icon.icns\n│   ├── 📄 icon.ico\n│   ├── 🖼️ icon.png\n│   ├── 📁 icons/\n│   │   ├── 🖼️ 1024x1024.png\n│   │   ├── 🖼️ 128x128.png\n│   │   ├── 🖼️ 16x16.png\n│   │   ├── 🖼️ 24x24.png\n│   │   ├── 🖼️ 256x256.png\n│   │   ├── 🖼️ 32x32.png\n│   │   ├── 🖼️ 48x48.png\n│   │   ├── 🖼️ 512x512.png\n│   │   └── 🖼️ 64x64.png\n│   ├── 🖼️ logo.png\n│   ├── 📄 nsis-installer.nsh\n│   ├── 🖼️ tray_icon.png\n│   ├── 🖼️ tray_icon_dark.png\n│   └── 🖼️ tray_icon_light.png\n├── ⚙️ dev-app-update.yml\n├── 📁 docs/\n│   ├── 📝 README.ja.md\n│   ├── 📝 README.zh.md\n│   ├── 📝 dev.md\n│   ├── 📝 sponsor.md\n│   └── 📁 technical/\n│       └── 📝 KnowledgeService.md\n├── ⚙️ electron-builder.yml\n├── 📜 electron.vite.config.ts\n├── 📄 eslint.config.mjs\n├── 📋 package.json\n├── 📁 packages/\n│   ├── 📁 artifacts/\n│   │   ├── 📝 README.md\n│   │   ├── 📋 package.json\n│   │   └── 📁 statics/\n│   ├── 📁 database/\n│   │   ├── 📝 README.md\n│   │   ├── 📁 data/\n│   │   ├── 📋 package.json\n│   │   ├── 📁 src/\n│   │   └── 📄 yarn.lock\n│   └── 📁 shared/\n│       ├── 📜 IpcChannel.ts\n│       └── 📁 config/\n├── 📁 resources/\n│   ├── 📁 cherry-studio/\n│   │   ├── 🌐 license.html\n│   │   └── 🌐 releases.html\n│   ├── 📁 data/\n│   │   └── 📋 agents.json\n│   ├── 📁 js/\n│   │   ├── 📜 bridge.js\n│   │   └── 📜 utils.js\n│   ├── 📁 scripts/\n│   │   ├── 📜 download.js\n│   │   ├── 📜 install-bun.js\n│   │   └── 📜 install-uv.js\n│   └── 📄 textMonitor.swift\n├── 📁 scripts/\n│   ├── 📜 after-pack.js\n│   ├── 📜 build-npm.js\n│   ├── 📜 check-i18n.js\n│   ├── 📜 check-i18n.ts\n│   ├── 📜 cloudflare-worker.js\n│   ├── 📜 notarize.js\n│   ├── 📜 remove-locales.js\n│   ├── 📜 replace-spaces.js\n│   ├── 📜 update-i18n.ts\n│   ├── 📜 utils.js\n│   └── 📜 version.js\n├── 📁 src/\n│   ├── 📁 components/\n│   ├── 📁 main/\n│   │   ├── 📜 config.ts\n│   │   ├── 📜 constant.ts\n│   │   ├── 📜 electron.d.ts\n│   │   ├── 📁 embeddings/\n│   │   ├── 📜 env.d.ts\n│   │   ├── 📜 index.ts\n│   │   ├── 📁 integration/\n│   │   ├── 📜 ipc.ts\n│   │   ├── 📁 loader/\n│   │   ├── 📁 mcpServers/\n│   │   ├── 📁 reranker/\n│   │   ├── 📁 services/\n│   │   └── 📁 utils/\n│   ├── 📁 preload/\n│   │   ├── 📜 index.d.ts\n│   │   └── 📜 index.ts\n│   └── 📁 renderer/\n│       ├── 🌐 index.html\n│       └── 📁 src/\n├── 📋 tsconfig.json\n├── 📋 tsconfig.node.json\n├── 📋 tsconfig.web.json\n└── 📄 yarn.lock\n```\n\n\u003c/details\u003e\n\n## 📝 To Do\n\n- [ ] Support config file, allow user to customize the default output format, filtering options, styles etc.\n- [ ] Better performance for large directory trees\n- [ ] Better way to show file/dir types\n- [ ] Streamline installation process for MacOS \u0026 Linux systems(help needed!)\n- [ ] And more! Tell me in issues if you have any ideas.\n\n## ♥️ Contribution\n\nThe project is in its early stages of development. All contributions are welcome, including raising issues, submitting pull requests, or giving the project a ⭐ star on GitHub!\n\n## ⭐ Star History\n\n\u003ca href=\"https://www.star-history.com/#shiquda/treex\u0026Timeline\"\u003e\n \u003cpicture\u003e\n   \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://api.star-history.com/svg?repos=shiquda/treex\u0026type=Timeline\u0026theme=dark\" /\u003e\n   \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://api.star-history.com/svg?repos=shiquda/treex\u0026type=Timeline\" /\u003e\n   \u003cimg alt=\"Star History Chart\" src=\"https://api.star-history.com/svg?repos=shiquda/treex\u0026type=Timeline\" /\u003e\n \u003c/picture\u003e\n\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshiquda%2Ftreex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshiquda%2Ftreex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshiquda%2Ftreex/lists"}