directure


Namedirecture JSON
Version 0.1.4 PyPI version JSON
download
home_pagehttps://github.com/yourusername/directure
SummaryA tool to explore and visualize directory structures
upload_time2024-09-12 07:32:07
maintainerNone
docs_urlNone
authorYour Name
requires_python>=3.6
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Directure = Directory + Structure

**Motivation**  
I created this tool after struggling to explain project structures and errors to ChatGPT. It was difficult to clearly communicate my project's directory structure and file contents. With this tool, you can easily generate a visual representation of your project's directory structure, including file contents if desired, which can then be shared or used to debug with AI models like ChatGPT.

## Features
- **Visualize Directory Structure**: Print the entire directory structure of your project.
- **Include File Contents**: Optionally append the contents of specific files or directories to the output for detailed exploration.
- **Ignore List**: Specify files and folders to ignore while exploring the structure.
- **Full Explore List**: Define directories for detailed exploration and file content output.
- **Write Output to File**: Generate an output file containing the directory structure and selected file contents.

## Usage

Run `directure.py` from the command line with several options:

```bash
python directure.py [options]
```

### Options:

- `-w`: Writes the directory structure and contents to an output file `structure.txt`.
- `--explore "path/to/directory"`: Limits exploration to a specific directory or set of directories/files.
- Directories or files can be ignored by listing them after the main command.

## Example Usage

Given the following sample directory structure:

```
project_root/
│-- src/
│   │-- app.py
│   │-- utils.py
│-- docs/
│   │-- README.md
│-- tests/
    │-- test_app.py
    │-- test_utils.py
```

### 1. Default Behavior:

Running the script with no additional flags will print the entire directory structure, ignoring the default ignore list (e.g., `venv`, `__pycache__`, `.git`).

```bash
python directure.py
```

Output:

```
|-- project_root
    |-- src
        |-- app.py
        |-- utils.py
    |-- docs
        |-- README.md
    |-- tests
        |-- test_app.py
        |-- test_utils.py
```

### 2. Writing Output to File:

You can save the structure and file contents into a file by using the `-w` flag.

```bash
python directure.py -w
```

This will create `structure.txt` in the current directory, containing:

```
Directory Structure:

|-- project_root
    |-- src
        |-- app.py
        |-- utils.py
    |-- docs
        |-- README.md
    |-- tests
        |-- test_app.py
        |-- test_utils.py


File Contents:

----------------------------------------
Content of app.py:

<file content>

----------------------------------------
Content of utils.py:

<file content>

----------------------------------------
Content of README.md:

<file content>

----------------------------------------
Content of test_app.py:

<file content>

----------------------------------------
Content of test_util.py:

<file content>

...
```

### 3. Exploring a Specific Directory:

To explore only a specific directory or file, use the `--explore` flag followed by the directory path. For example:

```bash
python directure.py --explore "src"
```

Output:

```
|-- project_root
    |-- src
        |-- app.py
        |-- utils.py
    |-- docs
    |-- tests
```

### 4. Exploring a Directory and Writing to File:

You can combine the `--explore` flag with the `-w` flag to write the structure and contents of the explored directory to the output file.

```bash
python directure.py --explore "src" -w
```

This will create or overwrite the `structure.txt` file with the content from the `src` directory only.

---

## Default Ignore List

By default, the following directories and files are ignored:

- `venv`
- `__pycache__`
- `.git`

You can extend this list by adding items as arguments when running the script.

---
## How It Works

- **`print_directory_structure(path, ignore_list, full_explore_list)`**: Recursively prints the directory structure, ignoring any directories or files on the ignore list and optionally fully exploring directories on the explore list.
  
- **`write_file_contents(path, ignore_list, full_explore_list)`**: Appends the contents of files in explored directories to the output.

- **`write_structure_and_contents(directory_path, ignore_list, output_filename, full_explore_list)`**: Combines the directory structure and file content writing functionalities into a single output file.

---

You can use this tool to generate a clean, structured output of your project that you can share or use for troubleshooting with AI tools.

---

## Further Resources

For more details, check out our [Github](https://github.com/Atharvatonape/Directure).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/yourusername/directure",
    "name": "directure",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Your Name",
    "author_email": "your.email@example.com",
    "download_url": "https://files.pythonhosted.org/packages/bb/d1/c4092d32c6ff329bc239b7c72d049efd55b9b0a3fef300628236a17b5a25/directure-0.1.4.tar.gz",
    "platform": null,
    "description": "\n# Directure = Directory + Structure\n\n**Motivation**  \nI created this tool after struggling to explain project structures and errors to ChatGPT. It was difficult to clearly communicate my project's directory structure and file contents. With this tool, you can easily generate a visual representation of your project's directory structure, including file contents if desired, which can then be shared or used to debug with AI models like ChatGPT.\n\n## Features\n- **Visualize Directory Structure**: Print the entire directory structure of your project.\n- **Include File Contents**: Optionally append the contents of specific files or directories to the output for detailed exploration.\n- **Ignore List**: Specify files and folders to ignore while exploring the structure.\n- **Full Explore List**: Define directories for detailed exploration and file content output.\n- **Write Output to File**: Generate an output file containing the directory structure and selected file contents.\n\n## Usage\n\nRun `directure.py` from the command line with several options:\n\n```bash\npython directure.py [options]\n```\n\n### Options:\n\n- `-w`: Writes the directory structure and contents to an output file `structure.txt`.\n- `--explore \"path/to/directory\"`: Limits exploration to a specific directory or set of directories/files.\n- Directories or files can be ignored by listing them after the main command.\n\n## Example Usage\n\nGiven the following sample directory structure:\n\n```\nproject_root/\n\u2502-- src/\n\u2502   \u2502-- app.py\n\u2502   \u2502-- utils.py\n\u2502-- docs/\n\u2502   \u2502-- README.md\n\u2502-- tests/\n    \u2502-- test_app.py\n    \u2502-- test_utils.py\n```\n\n### 1. Default Behavior:\n\nRunning the script with no additional flags will print the entire directory structure, ignoring the default ignore list (e.g., `venv`, `__pycache__`, `.git`).\n\n```bash\npython directure.py\n```\n\nOutput:\n\n```\n|-- project_root\n    |-- src\n        |-- app.py\n        |-- utils.py\n    |-- docs\n        |-- README.md\n    |-- tests\n        |-- test_app.py\n        |-- test_utils.py\n```\n\n### 2. Writing Output to File:\n\nYou can save the structure and file contents into a file by using the `-w` flag.\n\n```bash\npython directure.py -w\n```\n\nThis will create `structure.txt` in the current directory, containing:\n\n```\nDirectory Structure:\n\n|-- project_root\n    |-- src\n        |-- app.py\n        |-- utils.py\n    |-- docs\n        |-- README.md\n    |-- tests\n        |-- test_app.py\n        |-- test_utils.py\n\n\nFile Contents:\n\n----------------------------------------\nContent of app.py:\n\n<file content>\n\n----------------------------------------\nContent of utils.py:\n\n<file content>\n\n----------------------------------------\nContent of README.md:\n\n<file content>\n\n----------------------------------------\nContent of test_app.py:\n\n<file content>\n\n----------------------------------------\nContent of test_util.py:\n\n<file content>\n\n...\n```\n\n### 3. Exploring a Specific Directory:\n\nTo explore only a specific directory or file, use the `--explore` flag followed by the directory path. For example:\n\n```bash\npython directure.py --explore \"src\"\n```\n\nOutput:\n\n```\n|-- project_root\n    |-- src\n        |-- app.py\n        |-- utils.py\n    |-- docs\n    |-- tests\n```\n\n### 4. Exploring a Directory and Writing to File:\n\nYou can combine the `--explore` flag with the `-w` flag to write the structure and contents of the explored directory to the output file.\n\n```bash\npython directure.py --explore \"src\" -w\n```\n\nThis will create or overwrite the `structure.txt` file with the content from the `src` directory only.\n\n---\n\n## Default Ignore List\n\nBy default, the following directories and files are ignored:\n\n- `venv`\n- `__pycache__`\n- `.git`\n\nYou can extend this list by adding items as arguments when running the script.\n\n---\n## How It Works\n\n- **`print_directory_structure(path, ignore_list, full_explore_list)`**: Recursively prints the directory structure, ignoring any directories or files on the ignore list and optionally fully exploring directories on the explore list.\n  \n- **`write_file_contents(path, ignore_list, full_explore_list)`**: Appends the contents of files in explored directories to the output.\n\n- **`write_structure_and_contents(directory_path, ignore_list, output_filename, full_explore_list)`**: Combines the directory structure and file content writing functionalities into a single output file.\n\n---\n\nYou can use this tool to generate a clean, structured output of your project that you can share or use for troubleshooting with AI tools.\n\n---\n\n## Further Resources\n\nFor more details, check out our [Github](https://github.com/Atharvatonape/Directure).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A tool to explore and visualize directory structures",
    "version": "0.1.4",
    "project_urls": {
        "Homepage": "https://github.com/yourusername/directure"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "922f0717ba1fbc31ce359fac25875e2722ca1491b3941c48e6c3a1b4e1a2bcc9",
                "md5": "449cb98a8abb4e37f1503c62ca48c613",
                "sha256": "1ed5c82ce1b905b333e7c28379dedc15f425ef99dd89fa0f5ca795df3ff7f09e"
            },
            "downloads": -1,
            "filename": "directure-0.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "449cb98a8abb4e37f1503c62ca48c613",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 5577,
            "upload_time": "2024-09-12T07:32:06",
            "upload_time_iso_8601": "2024-09-12T07:32:06.501475Z",
            "url": "https://files.pythonhosted.org/packages/92/2f/0717ba1fbc31ce359fac25875e2722ca1491b3941c48e6c3a1b4e1a2bcc9/directure-0.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bbd1c4092d32c6ff329bc239b7c72d049efd55b9b0a3fef300628236a17b5a25",
                "md5": "7303f13878abf879a9452dbece8e432e",
                "sha256": "2cec7edb4db66666f884816f38884ec7894b138eb15b957d2591dd70072bca29"
            },
            "downloads": -1,
            "filename": "directure-0.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "7303f13878abf879a9452dbece8e432e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 5172,
            "upload_time": "2024-09-12T07:32:07",
            "upload_time_iso_8601": "2024-09-12T07:32:07.796400Z",
            "url": "https://files.pythonhosted.org/packages/bb/d1/c4092d32c6ff329bc239b7c72d049efd55b9b0a3fef300628236a17b5a25/directure-0.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-12 07:32:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "yourusername",
    "github_project": "directure",
    "github_not_found": true,
    "lcname": "directure"
}
        
Elapsed time: 0.87319s