Skip to main content

A command line utility to display and create directory structures

Project description

Tree3

Tree3-

PyPI License GitHub Repo stars PyPI Downloads

Tree3 is a command-line utility designed to simplify the process of working with directory structures (works on all operating systems: Linux, macOS, Windows and etc.). Its core functionalities are:

  1. Displaying Directory Structures: Generate a visual, tree-like representation of a specified directory, similar to the classic tree command but more useful.

    Example output:

/
├── src/
│   ├── main.py
│   └── utils.py
├── config.py
├── README.md
└── setup.py
  1. Creating Directory Structures: Parse a text file containing a predefined tree structure and create the corresponding directories and empty files on the filesystem.

The tool aims to assist developers, particularly when interacting with AI code generation tools or when sharing project structures. It provides options for filtering based on .gitignore rules, saving the output to a file, and copying the structure to the clipboard.

Installation

Install tree3 using pip:

pip install tree3

Usage

tree3 is invoked from the command line.

Synopsis

tree3 [OPTIONS] [path]

Arguments and Options

path (Optional): The directory path whose structure you want to display. Defaults to the current directory (.).
This argument is ignored if -i is used.

-o FILE, --output FILE: Save the generated tree structure to the specified FILE.

-i FILE, --input FILE: Read a tree structure definition from the specified FILE and create the corresponding directories and files.

-g, --ignore: Respect rules found in the .gitignore file within the target directory when generating the tree. This ignores files and directories specified in .gitignore.

-c, --copy: Copy the generated tree structure to the system clipboard.

-v, --version: Display the version of tree3 and exit.

-h, --help: Display the help message and exit.

Examples

1. Display the structure of the current directory:

tree3 [path]

output:

/
├── tree3/
│   ├── core/
│   │   ├── __init__.py
│   │   ├── builder.py
│   │   ├── parser.py
│   │   └── tree.py
│   ├── utils/
│   │   ├── __init__.py
│   │   ├── clipboard.py
│   │   ├── file_utils.py
│   │   └── gitignore.py
│   ├── __init__.py
│   ├── __main__.py
│   ├── cli.py
│   ├── config.py
│   └── constants.py
├── LICENSE
├── pyproject.toml
├── README.md
└── setup.py

2. Display the structure of a specific project directory:

tree3 /path/to/my/project

3. Display structure, ignoring files/dirs from .gitignore:

tree3 -g /path/to/my/project

4. Save the structure to a file and copy it to the clipboard:

tree3 my_project -c -o structure.txt

5. Create directories and files from a structure definition file:

tree3 -i structure.txt

Contributing

Feel free to open issues and pull requests on the GitHub repository.

License

This project is licensed under the MIT License.


Built with ♥ by Amir Mazinani!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tree3-0.2.0.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

tree3-0.2.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file tree3-0.2.0.tar.gz.

File metadata

  • Download URL: tree3-0.2.0.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tree3-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b00a65f65276a9ca1e8055db50df96d50e75f2b8fa1f794cb0f38ccd467702f7
MD5 d4f5923cdb67ebd4e34d30d90f1c9ed8
BLAKE2b-256 282a11a1493b32eba73b1c807f8e81e25f901de4a3fbf15faf5d184c6023ff3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree3-0.2.0.tar.gz:

Publisher: python-publish.yml on amirmazinani/tree3

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree3-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: tree3-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tree3-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 26361ebbb053e094fd8d42c910f17460726bf618af0f440c7ddf587d5dc4f3fa
MD5 9aee06ad8464d1028b2645e160ae9ace
BLAKE2b-256 d29572c13798bcb4c291a0b6d812c847735f58f702ed8ca572dfa8a188c0c7c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree3-0.2.0-py3-none-any.whl:

Publisher: python-publish.yml on amirmazinani/tree3

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page