Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/timf34/printdirtree
Print a directory tree structure with customizable exclusions via a Python CLI.
https://github.com/timf34/printdirtree
os package pip pypi-package python
Last synced: 3 months ago
JSON representation
Print a directory tree structure with customizable exclusions via a Python CLI.
- Host: GitHub
- URL: https://github.com/timf34/printdirtree
- Owner: timf34
- License: mit
- Created: 2024-02-07T00:38:25.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-09-06T20:09:26.000Z (5 months ago)
- Last Synced: 2024-11-14T04:57:19.023Z (3 months ago)
- Topics: os, package, pip, pypi-package, python
- Language: Python
- Homepage: https://pypi.org/project/printdirtree/
- Size: 22.5 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PrintDirTree
`printdirtree` is a command-line utility that prints the structure of a directory tree,
allowing you to easily specify files and directories to exclude.**Example:**
```bash
$ printdirtree
PrintDirTree
├── MANIFEST.in
├── README.md
├── printdirtree
│ ├── __init__.py
│ └── __main__.py
└── setup.py
```This tool is very useful to aid with prompting ChatGPT.
## Installation
Install `printdirtree` easily with pip:
```sh
pip install printdirtree
```## Usage
To use `printdirtree`, simply run the command followed by optional arguments to tailor the output to your needs.
The basic usage prints the current directory structure:```sh
printdirtree
```### Specifying a Directory
To print the structure of a specific directory:
```sh
printdirtree --dir /path/to/directory
```### Excluding Directories and Files
Exclude specific directories and/or file patterns:
```sh
printdirtree --exclude-dir node_modules --exclude-dir .git --exclude-file "*.log"
```### Saving Preferences
To save your exclusions for future runs:
```sh
printdirtree --exclude-dir temp --exclude-file "*.tmp" --save
```### Viewing Current Exclusions
See what exclusions are currently saved:
```sh
printdirtree --view-exclusions
```### Including Directories and Files Back
To remove exclusions and include directories or files back into the printout:
```sh
printdirtree --include-dir temp --include-file "*.tmp" --save
```## Example Usage
After installing `printdirtree`, you can run it to visualize the structure of your project directory. Here's an example command that excludes `.git` files:
```sh
printdirtree --exclude-file ".git"
```Output for the `PrintDirTree` project might look like this:
```
PrintDirTree
├── MANIFEST.in
├── README.md
├── printdirtree
│ ├── __init__.py
│ └── __main__.py
└── setup.py
```