prodir/README.md

2.8 KiB

prodir

This is a Python package designed to display and create directory structures in a tree-like format. This tool provides an easy-to-read overview of the directory hierarchy, making it easier for developers to navigate complex project structures and automate the creation of directory layouts from predefined files.

Installation

To install prodir, you can use pip:

pip install git+https://gitea.fabelous.app/Fabel/prodir.git

Usage

You can run prodir from the command line. By default, it will analyze the current directory and print its structure in a tree-like format. You can also specify a path to another directory.

To display the directory structure of the current directory:

python -m prodir display

or

prodir

To display the directory structure of a specific directory:

python -m prodir display /path/to/directory

or

python -m prodir /path/to/directory

To create a directory structure from a file:

python -m prodir create /path/to/structure/file.txt -o /output/directory

or 

python -m prodir create /path/to/structure/file.txt #will create it in current dir

Options

  • -v or --verbose: Show more detailed output, including information about the path being analyzed.
  • -o or --output: Specify the output directory for the create command.

Examples:

python -m prodir display /path/to/directory -v

Important Files and Folders Ignored

By default, prodir ignores files and folders that start with _ or .. However, it does include the following exceptions:

  • __init__.py and __main__.py files: These are considered important and will be included in the output.
  • Special folders like build, .git, node_modules, etc.: These are also ignored to keep the output focused on the essential parts of the directory structure.

Example Input

project/
├── src/
│   ├── __init__.py
│   ├── main.py
│   ├── module1.py
│   └── module2.py
├── config/
│   └── config.yaml
├── .gitignore
├── pyproject.toml
├── setup.py
├── LICENSE
└── README.m

Example Output

LICENSE
README.m
config/
└── config.yaml
pyproject.toml
setup.py
src/
├── __init__.py
├── main.py
├── module1.py
└── module2.py

Commands

  • display: Displays the directory structure of a specified path or the current directory.

    • Usage: prodir display [path] [-v]
    • Example: python -m prodir display /path/to/directory
  • create: Creates a directory structure from a file containing the structure definition.

    • Usage: prodir create [file] [output_directory] [-v]
    • Example: python -m prodir create /path/to/structure/file.txt