# Directory Tree Script
This script generates a visual representation of the directory structure of a specified root directory. It supports exporting the structure to a Markdown file and offers various options to customize the output.
```
Usage: tree-script [SWITCHES] directory
Generate a directory tree structure for a given path, with options for depth
limitation, colorful output, file sizes, and exporting to Markdown.
positional arguments:
directory Path to the root directory to analyze
optional arguments:
-h, --help Show this help message and exit
-md, --export-md Export the directory structure to a Markdown file
-d DEPTH, --depth DEPTH
Limit the depth of directory traversal (e.g., -d 2)
-v, --verbose Enable verbose logging for debugging purposes
-c, --color Enable colorful output for better readability
-s, --size Show file sizes and line counts in the output
Examples:
tree-script /path/to/directory
tree-script /path/to/directory -d 2 -s
tree-script /path/to/directory -md -c
```
### Example Output
![-d](https://github.com/user-attachments/assets/dea8ad31-55ae-4658-9ccd-06074719c769)
## Installation
```bash
pip install tree-scribe
```
Or
```bash
pipx install tree-scribe
```
## Command-Line Switches
| Switch/Option | Description | Example Usage |
| ------------------------ | --------------------------------------------------------------- | ---------------------------------------------------------- |
| `<directory-path>` | Path to the root directory whose structure you want to display. | `tree-scribe /home/project` |
| `-md`, `--export-md` | Export the directory structure to a Markdown file. | `tree-scribe /home/project -md` |
| `-d`, `--depth <number>` | Limit the depth of directory traversal. | `tree-scribe /home/project -d 2` |
| `-v`, `--verbose` | Enable verbose logging for detailed output. | `tree-scribe /home/project -v` |
| `-c`, `--color` | Enable colorful output in the terminal. | `tree-scribe /home/project -c` |
| `-s`, `--size` | Show line and size. | `tree-scribe /home/project -s` |
| `--exclude` | Exclude file and folder. | `tree_scribe /path/to/directory --exclude dist build .git` |
## Examples
1. **Display the Directory Structure**
```bash
tree-scribe /home/project
```
2. **Export to Markdown**
```bash
tree-scribe /home/project --export-md
```
3. **Limit Depth to 2 Levels**
```bash
tree-scribe /home/project --depth 2
```
4. **Enable Verbose Logging**
```bash
tree-scribe /home/project --verbose
```
5. **Enable Colorful Output**
```bash
tree-scribe /home/project -c
```
6. **Show line and size**
```bash
tree-scribe /home/project -s
```
7. **Combine Options**
```bash
tree-scribe /home/project --export-md --depth 3 -c -s
```
8. **Exclude files or folder**
```bash
tree_scribe /path/to/directory --exclude dist build .git
```
### Troubleshooting
- Permission Errors: If you encounter permission errors, make sure you have the necessary permissions to access the directories and files.
- Invalid Directory Path: Ensure the specified directory path is correct and exists.
### License
This script is provided under the MIT License. See the LICENSE file for more information.
### Contributing
Feel free to submit issues, suggestions, or pull requests. Contributions are welcome!
Raw data
{
"_id": null,
"home_page": "https://github.com/mamad-1999/tree-scribe",
"name": "tree-scribe",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "mamad1999",
"author_email": "www.mmhmdmm83@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/73/91/66e0737b91920044372f82626aca9380d29aa6470cb1cfc6a4dd4dc63979/tree_scribe-0.0.7.tar.gz",
"platform": null,
"description": "# Directory Tree Script\n\nThis script generates a visual representation of the directory structure of a specified root directory. It supports exporting the structure to a Markdown file and offers various options to customize the output.\n\n```\nUsage: tree-script [SWITCHES] directory\n\nGenerate a directory tree structure for a given path, with options for depth\nlimitation, colorful output, file sizes, and exporting to Markdown.\n\npositional arguments:\n directory Path to the root directory to analyze\n\noptional arguments:\n -h, --help Show this help message and exit\n -md, --export-md Export the directory structure to a Markdown file\n -d DEPTH, --depth DEPTH\n Limit the depth of directory traversal (e.g., -d 2)\n -v, --verbose Enable verbose logging for debugging purposes\n -c, --color Enable colorful output for better readability\n -s, --size Show file sizes and line counts in the output\n\nExamples:\n tree-script /path/to/directory\n tree-script /path/to/directory -d 2 -s\n tree-script /path/to/directory -md -c\n```\n\n### Example Output\n\n![-d](https://github.com/user-attachments/assets/dea8ad31-55ae-4658-9ccd-06074719c769)\n\n## Installation\n\n```bash\n pip install tree-scribe\n```\n\nOr\n\n```bash\n pipx install tree-scribe\n```\n\n## Command-Line Switches\n\n| Switch/Option | Description | Example Usage |\n| ------------------------ | --------------------------------------------------------------- | ---------------------------------------------------------- |\n| `<directory-path>` | Path to the root directory whose structure you want to display. | `tree-scribe /home/project` |\n| `-md`, `--export-md` | Export the directory structure to a Markdown file. | `tree-scribe /home/project -md` |\n| `-d`, `--depth <number>` | Limit the depth of directory traversal. | `tree-scribe /home/project -d 2` |\n| `-v`, `--verbose` | Enable verbose logging for detailed output. | `tree-scribe /home/project -v` |\n| `-c`, `--color` | Enable colorful output in the terminal. | `tree-scribe /home/project -c` |\n| `-s`, `--size` | Show line and size. | `tree-scribe /home/project -s` |\n| `--exclude` | Exclude file and folder. | `tree_scribe /path/to/directory --exclude dist build .git` |\n\n## Examples\n\n1. **Display the Directory Structure**\n\n ```bash\n tree-scribe /home/project\n ```\n\n2. **Export to Markdown**\n\n ```bash\n tree-scribe /home/project --export-md\n ```\n\n3. **Limit Depth to 2 Levels**\n\n ```bash\n tree-scribe /home/project --depth 2\n ```\n\n4. **Enable Verbose Logging**\n\n ```bash\n tree-scribe /home/project --verbose\n ```\n\n5. **Enable Colorful Output**\n\n ```bash\n tree-scribe /home/project -c\n ```\n\n6. **Show line and size**\n\n ```bash\n tree-scribe /home/project -s\n ```\n\n7. **Combine Options**\n\n ```bash\n tree-scribe /home/project --export-md --depth 3 -c -s\n ```\n\n8. **Exclude files or folder**\n\n ```bash\n tree_scribe /path/to/directory --exclude dist build .git\n ```\n\n### Troubleshooting\n\n- Permission Errors: If you encounter permission errors, make sure you have the necessary permissions to access the directories and files.\n- Invalid Directory Path: Ensure the specified directory path is correct and exists.\n\n### License\n\nThis script is provided under the MIT License. See the LICENSE file for more information.\n\n### Contributing\n\nFeel free to submit issues, suggestions, or pull requests. Contributions are welcome!\n",
"bugtrack_url": null,
"license": null,
"summary": "Generate and export directory tree structures with optional color output.",
"version": "0.0.7",
"project_urls": {
"Homepage": "https://github.com/mamad-1999/tree-scribe"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3251236d9269fafebc1f202dc36e0c32a04972b079ef6372ffd9f1a7e3119e27",
"md5": "45bb700a748922d298cdc932261be9f0",
"sha256": "d0db1ac7d6b26deed0da4f9b1a6f94b45a5d9ba21aa82ffac2452845a5c5a218"
},
"downloads": -1,
"filename": "tree_scribe-0.0.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "45bb700a748922d298cdc932261be9f0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 7009,
"upload_time": "2024-12-08T19:22:01",
"upload_time_iso_8601": "2024-12-08T19:22:01.469483Z",
"url": "https://files.pythonhosted.org/packages/32/51/236d9269fafebc1f202dc36e0c32a04972b079ef6372ffd9f1a7e3119e27/tree_scribe-0.0.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "739166e0737b91920044372f82626aca9380d29aa6470cb1cfc6a4dd4dc63979",
"md5": "10b4f4969aadb6afde6848815929b014",
"sha256": "c37034ca182c3f815c16aabe9d1301a942df660842ff32d919406f7247409c01"
},
"downloads": -1,
"filename": "tree_scribe-0.0.7.tar.gz",
"has_sig": false,
"md5_digest": "10b4f4969aadb6afde6848815929b014",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 6548,
"upload_time": "2024-12-08T19:22:02",
"upload_time_iso_8601": "2024-12-08T19:22:02.755120Z",
"url": "https://files.pythonhosted.org/packages/73/91/66e0737b91920044372f82626aca9380d29aa6470cb1cfc6a4dd4dc63979/tree_scribe-0.0.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-08 19:22:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mamad-1999",
"github_project": "tree-scribe",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "tree-scribe"
}