Skip to main content

Convert a directory structure and its contents into a single text file, including the tree output and file contents in markdown code blocks.

Project description

repo-to-text

repo-to-text is an open-source project that converts the structure and contents of a directory (repository) into a single text file. By executing a simple command in the terminal, this tool generates a text representation of the directory, including the output of the tree command and the contents of each file, formatted for easy reading and sharing.

Features

  • Generates a text representation of a directory's structure.
  • Includes the output of the tree command.
  • Saves the contents of each file, encapsulated in markdown code blocks.
  • Copies the generated text representation to the clipboard for easy sharing.
  • Easy to install and use via pip and Homebrew.

Installation

Using pip

To install repo-to-text via pip, run the following command:

pip install repo-to-text

Usage

After installation, you can use the repo-to-text command in your terminal. Navigate to the directory you want to convert and run:

repo-to-text

This will create a file named repo_snapshot_YYYY-MM-DD-HH-MM-SS-UTC.txt in the current directory with the text representation of the repository. The contents of this file will also be copied to your clipboard for easy sharing.

Options

You can customize the behavior of repo-to-text with the following options:

  • --output-dir <path>: Specify an output directory where the generated text file will be saved. For example:

    repo-to-text --output-dir /path/to/output
    

    This will save the file in the specified output directory instead of the current directory.

  • --debug: Enable DEBUG logging. By default, repo-to-text runs with INFO logging level. To enable DEBUG logging, use the --debug flag:

    repo-to-text --debug
    

Example Output

The generated text file will include the directory structure and contents of each file. For a full example, see the example output for this repository.

Install Locally

To install repo-to-text locally for development, follow these steps:

  1. Clone the repository:

    git clone https://github.com/kirill-markin/repo-to-text
    cd repo-to-text
    
  2. Install the package locally:

    pip install -e .
    

Installing Dependencies

To install all the required dependencies, run the following command:

pip install -r requirements.txt

Running Tests

To run the tests, use the following command:

pytest

Uninstall

To uninstall the package, run the following command from the directory where the repository is located:

pip uninstall repo-to-text

Contributing

Contributions are welcome! If you have any suggestions or find a bug, please open an issue or submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

This project is maintained by Kirill Markin. For any inquiries or feedback, please contact markinkirill@gmail.com.

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

repo_to_text-0.1.2.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

repo_to_text-0.1.2-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file repo_to_text-0.1.2.tar.gz.

File metadata

  • Download URL: repo_to_text-0.1.2.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.19

File hashes

Hashes for repo_to_text-0.1.2.tar.gz
Algorithm Hash digest
SHA256 59c1c5c1d87f7272b6a2e8910cb8989ee33b4d444d9d84b2b5c70eeb79010b02
MD5 1340f0b8d340790a1ac5d1515c50b93f
BLAKE2b-256 aaca1efd645e5e1b679f18f95aca6738d6564e669ef43699565423f2f84899c0

See more details on using hashes here.

File details

Details for the file repo_to_text-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: repo_to_text-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.19

File hashes

Hashes for repo_to_text-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 822a2bc3336d0cc136b0ab91eeb395006a96e5c242035b7450c8e41c9e34335b
MD5 d02b5c244ec956ed92970ff542c8d350
BLAKE2b-256 43317c645a5044dac2ac025c52fe5b2cb9d9d22130eec89b5abeac88bb708189

See more details on using hashes here.

Supported by

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