treely


Nametreely JSON
Version 1.1.1 PyPI version JSON
download
home_pageNone
SummaryA modern, beautiful and powerful command-line directory tree generator with advanced filtering and code-viewing capabilities.
upload_time2025-08-06 12:53:19
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseMIT License Copyright (c) 2025 Rudra Mondal Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords cli directory dirtree foldertree generator structure tool tree treegen treely
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Treely 🌳

A modern, beautiful, and powerful command-line directory tree generator. `treely` goes beyond a simple `tree` command by offering smart filtering, automatic `.gitignore` parsing, and a killer feature: the ability to output the contents of your code files, ready to be saved, shared, or copied directly to your clipboard.

It's the perfect tool for scaffolding a project's structure for documentation, preparing context for AI/LLM prompts, or getting a high-level overview of a new codebase.

[![PyPI version](https://img.shields.io/pypi/v/treely.svg)](https://pypi.org/project/treely/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python Versions](https://img.shields.io/pypi/pyversions/treely.svg)](https://pypi.org/project/treely/)
![GitHub stars](https://img.shields.io/github/stars/rudra-mondal/treely)

![Treely Demo GIF](https://github.com/user-attachments/assets/bdba702c-5786-4a12-9c93-10c48b2b1577)

*(Note: The demo GIF shows an older version!)*

## 🌟 Key Features

*   **Elegant Tree Structure:** Generates a clean, easy-to-read directory tree with colorful output.
*   **Powerful Code Context:** Use `--code` to print all relevant code, and then use the `--exclude` flag to surgically remove files, directories, or patterns (like `lib/*` or `*.log`) from the code output without hiding them from the tree.
*   **Automatic `.gitignore` Support:** The `--use-gitignore` flag intelligently and automatically excludes files and directories specified in your `.gitignore` file. No more manual `--ignore` flags for `node_modules` or `dist`!
*   **Export & Share:**
    *   **Copy to Clipboard (`-c`):** Instantly copy the entire tree and code output to your clipboard, perfect for pasting into LLM prompts (like GPT), GitHub issues, or pull requests.
    *   **Save to File (`-o`):** Save the clean, colorless output directly to a file for documentation or artifacts.
*   **Advanced Filtering & Display:**
    *   Limit the tree depth (`-L`).
    *   Filter by glob patterns (`--pattern`).
    *   Ignore files and directories from the tree (`--ignore`).
    *   Display file sizes (`--show-size`).
    *   Get a project summary (`-s`).
*   **Cross-Platform:** Works seamlessly on Windows, macOS, and Linux.

## 📦 Installation

You can install `treely` directly from PyPI. The necessary dependencies (`pyperclip` and `pathspec`) will be installed automatically.

```bash
pip install treely
```

Ensure that your Python scripts directory is in your system's `PATH` to run `treely` from anywhere.

## 🚀 Usage

### Basic Command

To generate a tree for the current directory:
```bash
treely
```

For a specific directory:
```bash
treely /path/to/your/project
```

### Command-line Options

This is the output from `treely --help`, showing the new, simplified flags.

```
usage: treely [-h] [-a] [-L LEVEL] [--pattern PATTERN] [--ignore PATTERNS] [--code] [--exclude PATTERNS] [--use-gitignore] [-s] [--show-size] [-o [FILENAME]] [-c] [root_path]

A beautiful and professional directory tree generator.

positional arguments:
  root_path             The starting folder for the tree. Uses current folder if not specified.

options:
  -h, --help            show this help message and exit
  -a, --all             Show all items, including hidden ones (e.g., '.git').
  -L LEVEL, --level LEVEL
                        How many folders deep to look (e.g., -L 2).
  --pattern PATTERN     Show only files/folders that match a pattern (e.g., "*.py").
  --ignore PATTERNS     Don't show items matching a pattern in the tree. Use '|' to separate.
  --code                Display the content of all detected code files after the tree.
  --exclude PATTERNS    When using --code, exclude files/folders from the code output.
                        Use '|' to separate patterns (e.g., "lib/*|*.log|file.js").
  --use-gitignore       Automatically ignore files/dirs from the tree listed in .gitignore.
  -s, --summary         Print a summary of the number of directories and files.
  --show-size           Display the size of each file.
  -o [FILENAME], --output [FILENAME]
                        Save output to a file. Defaults to 'treely_output.txt'. Banner/colors are excluded.
  -c, --copy            Copy output to the clipboard. Banner/colors are excluded.

Examples:
  # Generate a tree for the current folder
  treely

  # Use the project's .gitignore to automatically exclude files from the tree
  treely --use-gitignore

  # Show the tree and the content of all code files
  treely --code

  # Show code content, but exclude all files in 'lib' and 'custom' directories
  treely --code --exclude "lib/*|custom/*"

  # Show code, but exclude all HTML files and a specific JS file
  treely --code --exclude "*.html|panel.js"
```

## ✨ Workflow Examples

### 1. The Smart Default: Using `.gitignore`

This is the recommended way to get a clean overview of any project. `treely` will read your `.gitignore` and automatically exclude `node_modules/` and `.env` from the tree.

**Command:**
```bash
treely my-web-app --use-gitignore
```

**Output:**
```
my-web-app/
├── public/
│   └── index.html
├── src/
│   ├── App.js
│   └── index.js
├── .gitignore
└── package.json
```
Notice how `.git` and `node_modules` are all gone with one simple flag!

### 2. Create Project Documentation

Generate a complete project overview with file sizes and a summary, and save it directly to a Markdown file.

**Command:**
```bash
treely my-web-app --use-gitignore --show-size -s -o project_structure.md
```

**Console Message:**
```
... (banner) ...
✔ Output successfully saved to project_structure.md
```

### 3. Prepare a Basic AI/LLM Prompt

This is `treely`'s superpower. Generate a complete project context (structure and all relevant code) and copy it directly to your clipboard. You are now ready to paste it into ChatGPT, Claude, or any other LLM.

**Command:**
```bash
treely my-web-app --use-gitignore --code -c
```

**Console Message:**
```
... (banner) ...
✔ Tree structure copied to clipboard.
```
Your clipboard now contains the full tree and the contents of `index.html`, `App.js`, `index.js`, `.gitignore`, and `package.json`, perfectly formatted.

### 4. Advanced Prompting with Exclusions

Imagine you want to provide context about a project, but you want to exclude boilerplate, libraries, or irrelevant files from the code output to save tokens and focus the AI's attention. This is where `--exclude` shines.

Let's use this structure:
```
Silence Cutter/
├── CSXS/
│   └── manifest.xml
├── custom/
│   └── Mp3.epr
├── lib/
│   ├── CSInterface.js
│   └── Vulcan.js
├── .debug
└── panel.js
```

**Goal:** Get the code for the project, but exclude the entire `lib` directory and the specific `Mp3.epr` file.

**Command:**
```bash
treely "Silence Cutter/" --code --exclude "lib/*|custom/Mp3.epr"
```

**Result:**
The output will show the complete directory tree, including `lib/` and `custom/`. However, the `--- FILE CONTENTS ---` section will intelligently skip the code for `CSInterface.js`, `Vulcan.js`, and `Mp3.epr`, giving you a cleaner, more focused result.

## 🤝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the [issues page](https://github.com/rudra-mondal/treely/issues).

1.  Fork the Project
2.  Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3.  Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4.  Push to the Branch (`git push origin feature/AmazingFeature`)
5.  Open a Pull Request

## 📄 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "treely",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "cli, directory, dirtree, foldertree, generator, structure, tool, tree, treegen, treely",
    "author": null,
    "author_email": "Rudra Mondal <rudramondal815@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/7d/04/f9aa6315cb307a23d56a59024ffe50a71d042b24c69a81d9e310031d9153/treely-1.1.1.tar.gz",
    "platform": null,
    "description": "# Treely \ud83c\udf33\n\nA modern, beautiful, and powerful command-line directory tree generator. `treely` goes beyond a simple `tree` command by offering smart filtering, automatic `.gitignore` parsing, and a killer feature: the ability to output the contents of your code files, ready to be saved, shared, or copied directly to your clipboard.\n\nIt's the perfect tool for scaffolding a project's structure for documentation, preparing context for AI/LLM prompts, or getting a high-level overview of a new codebase.\n\n[![PyPI version](https://img.shields.io/pypi/v/treely.svg)](https://pypi.org/project/treely/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Python Versions](https://img.shields.io/pypi/pyversions/treely.svg)](https://pypi.org/project/treely/)\n![GitHub stars](https://img.shields.io/github/stars/rudra-mondal/treely)\n\n![Treely Demo GIF](https://github.com/user-attachments/assets/bdba702c-5786-4a12-9c93-10c48b2b1577)\n\n*(Note: The demo GIF shows an older version!)*\n\n## \ud83c\udf1f Key Features\n\n*   **Elegant Tree Structure:** Generates a clean, easy-to-read directory tree with colorful output.\n*   **Powerful Code Context:** Use `--code` to print all relevant code, and then use the `--exclude` flag to surgically remove files, directories, or patterns (like `lib/*` or `*.log`) from the code output without hiding them from the tree.\n*   **Automatic `.gitignore` Support:** The `--use-gitignore` flag intelligently and automatically excludes files and directories specified in your `.gitignore` file. No more manual `--ignore` flags for `node_modules` or `dist`!\n*   **Export & Share:**\n    *   **Copy to Clipboard (`-c`):** Instantly copy the entire tree and code output to your clipboard, perfect for pasting into LLM prompts (like GPT), GitHub issues, or pull requests.\n    *   **Save to File (`-o`):** Save the clean, colorless output directly to a file for documentation or artifacts.\n*   **Advanced Filtering & Display:**\n    *   Limit the tree depth (`-L`).\n    *   Filter by glob patterns (`--pattern`).\n    *   Ignore files and directories from the tree (`--ignore`).\n    *   Display file sizes (`--show-size`).\n    *   Get a project summary (`-s`).\n*   **Cross-Platform:** Works seamlessly on Windows, macOS, and Linux.\n\n## \ud83d\udce6 Installation\n\nYou can install `treely` directly from PyPI. The necessary dependencies (`pyperclip` and `pathspec`) will be installed automatically.\n\n```bash\npip install treely\n```\n\nEnsure that your Python scripts directory is in your system's `PATH` to run `treely` from anywhere.\n\n## \ud83d\ude80 Usage\n\n### Basic Command\n\nTo generate a tree for the current directory:\n```bash\ntreely\n```\n\nFor a specific directory:\n```bash\ntreely /path/to/your/project\n```\n\n### Command-line Options\n\nThis is the output from `treely --help`, showing the new, simplified flags.\n\n```\nusage: treely [-h] [-a] [-L LEVEL] [--pattern PATTERN] [--ignore PATTERNS] [--code] [--exclude PATTERNS] [--use-gitignore] [-s] [--show-size] [-o [FILENAME]] [-c] [root_path]\n\nA beautiful and professional directory tree generator.\n\npositional arguments:\n  root_path             The starting folder for the tree. Uses current folder if not specified.\n\noptions:\n  -h, --help            show this help message and exit\n  -a, --all             Show all items, including hidden ones (e.g., '.git').\n  -L LEVEL, --level LEVEL\n                        How many folders deep to look (e.g., -L 2).\n  --pattern PATTERN     Show only files/folders that match a pattern (e.g., \"*.py\").\n  --ignore PATTERNS     Don't show items matching a pattern in the tree. Use '|' to separate.\n  --code                Display the content of all detected code files after the tree.\n  --exclude PATTERNS    When using --code, exclude files/folders from the code output.\n                        Use '|' to separate patterns (e.g., \"lib/*|*.log|file.js\").\n  --use-gitignore       Automatically ignore files/dirs from the tree listed in .gitignore.\n  -s, --summary         Print a summary of the number of directories and files.\n  --show-size           Display the size of each file.\n  -o [FILENAME], --output [FILENAME]\n                        Save output to a file. Defaults to 'treely_output.txt'. Banner/colors are excluded.\n  -c, --copy            Copy output to the clipboard. Banner/colors are excluded.\n\nExamples:\n  # Generate a tree for the current folder\n  treely\n\n  # Use the project's .gitignore to automatically exclude files from the tree\n  treely --use-gitignore\n\n  # Show the tree and the content of all code files\n  treely --code\n\n  # Show code content, but exclude all files in 'lib' and 'custom' directories\n  treely --code --exclude \"lib/*|custom/*\"\n\n  # Show code, but exclude all HTML files and a specific JS file\n  treely --code --exclude \"*.html|panel.js\"\n```\n\n## \u2728 Workflow Examples\n\n### 1. The Smart Default: Using `.gitignore`\n\nThis is the recommended way to get a clean overview of any project. `treely` will read your `.gitignore` and automatically exclude `node_modules/` and `.env` from the tree.\n\n**Command:**\n```bash\ntreely my-web-app --use-gitignore\n```\n\n**Output:**\n```\nmy-web-app/\n\u251c\u2500\u2500 public/\n\u2502   \u2514\u2500\u2500 index.html\n\u251c\u2500\u2500 src/\n\u2502   \u251c\u2500\u2500 App.js\n\u2502   \u2514\u2500\u2500 index.js\n\u251c\u2500\u2500 .gitignore\n\u2514\u2500\u2500 package.json\n```\nNotice how `.git` and `node_modules` are all gone with one simple flag!\n\n### 2. Create Project Documentation\n\nGenerate a complete project overview with file sizes and a summary, and save it directly to a Markdown file.\n\n**Command:**\n```bash\ntreely my-web-app --use-gitignore --show-size -s -o project_structure.md\n```\n\n**Console Message:**\n```\n... (banner) ...\n\u2714 Output successfully saved to project_structure.md\n```\n\n### 3. Prepare a Basic AI/LLM Prompt\n\nThis is `treely`'s superpower. Generate a complete project context (structure and all relevant code) and copy it directly to your clipboard. You are now ready to paste it into ChatGPT, Claude, or any other LLM.\n\n**Command:**\n```bash\ntreely my-web-app --use-gitignore --code -c\n```\n\n**Console Message:**\n```\n... (banner) ...\n\u2714 Tree structure copied to clipboard.\n```\nYour clipboard now contains the full tree and the contents of `index.html`, `App.js`, `index.js`, `.gitignore`, and `package.json`, perfectly formatted.\n\n### 4. Advanced Prompting with Exclusions\n\nImagine you want to provide context about a project, but you want to exclude boilerplate, libraries, or irrelevant files from the code output to save tokens and focus the AI's attention. This is where `--exclude` shines.\n\nLet's use this structure:\n```\nSilence Cutter/\n\u251c\u2500\u2500 CSXS/\n\u2502   \u2514\u2500\u2500 manifest.xml\n\u251c\u2500\u2500 custom/\n\u2502   \u2514\u2500\u2500 Mp3.epr\n\u251c\u2500\u2500 lib/\n\u2502   \u251c\u2500\u2500 CSInterface.js\n\u2502   \u2514\u2500\u2500 Vulcan.js\n\u251c\u2500\u2500 .debug\n\u2514\u2500\u2500 panel.js\n```\n\n**Goal:** Get the code for the project, but exclude the entire `lib` directory and the specific `Mp3.epr` file.\n\n**Command:**\n```bash\ntreely \"Silence Cutter/\" --code --exclude \"lib/*|custom/Mp3.epr\"\n```\n\n**Result:**\nThe output will show the complete directory tree, including `lib/` and `custom/`. However, the `--- FILE CONTENTS ---` section will intelligently skip the code for `CSInterface.js`, `Vulcan.js`, and `Mp3.epr`, giving you a cleaner, more focused result.\n\n## \ud83e\udd1d Contributing\n\nContributions, issues, and feature requests are welcome! Feel free to check the [issues page](https://github.com/rudra-mondal/treely/issues).\n\n1.  Fork the Project\n2.  Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3.  Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n4.  Push to the Branch (`git push origin feature/AmazingFeature`)\n5.  Open a Pull Request\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2025 Rudra Mondal\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.",
    "summary": "A modern, beautiful and powerful command-line directory tree generator with advanced filtering and code-viewing capabilities.",
    "version": "1.1.1",
    "project_urls": {
        "Homepage": "https://github.com/rudra-mondal/treely"
    },
    "split_keywords": [
        "cli",
        " directory",
        " dirtree",
        " foldertree",
        " generator",
        " structure",
        " tool",
        " tree",
        " treegen",
        " treely"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "cb72563829c752c2e8a2855caedf70cadd6de6c7e97c0b31429f43535d2ae0b6",
                "md5": "8d67b43c7aed70c8333ce417820daf54",
                "sha256": "21471f4a560cb9c6e83c313df3ac141481003982c48a9e7b9db92235e0d218c4"
            },
            "downloads": -1,
            "filename": "treely-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8d67b43c7aed70c8333ce417820daf54",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 10089,
            "upload_time": "2025-08-06T12:53:18",
            "upload_time_iso_8601": "2025-08-06T12:53:18.521739Z",
            "url": "https://files.pythonhosted.org/packages/cb/72/563829c752c2e8a2855caedf70cadd6de6c7e97c0b31429f43535d2ae0b6/treely-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7d04f9aa6315cb307a23d56a59024ffe50a71d042b24c69a81d9e310031d9153",
                "md5": "ecff445820cbca418bcc5e84c3c6060a",
                "sha256": "3f27bce7826bb892dd7e7f4ee2f745afbd0dd3cdaf9cb9a2804590d1e2fa1c2b"
            },
            "downloads": -1,
            "filename": "treely-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "ecff445820cbca418bcc5e84c3c6060a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 8840,
            "upload_time": "2025-08-06T12:53:19",
            "upload_time_iso_8601": "2025-08-06T12:53:19.861467Z",
            "url": "https://files.pythonhosted.org/packages/7d/04/f9aa6315cb307a23d56a59024ffe50a71d042b24c69a81d9e310031d9153/treely-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-06 12:53:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rudra-mondal",
    "github_project": "treely",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "treely"
}
        
Elapsed time: 0.86379s