File size: 1,617 Bytes
2acca5f
6f74dd4
a76d9b4
 
 
2acca5f
b26ae3c
2acca5f
6f74dd4
b26ae3c
2acca5f
a0f4f84
2acca5f
 
6f74dd4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a76d9b4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
title: repo2txt
emoji: 🗃️
colorFrom: blue
colorTo: blue
sdk: gradio
sdk_version: 4.42.0
app_file: app.py
pinned: true
#header: mini
license: mit
short_description: GitHub repo to text file converter for easy archiving & LLM
---

# repo2txt

`repo2txt` is a Python package that clones a GitHub repository, generates a text file containing the repository's directory structure and the contents of all its files, and handles cleanup.

## Installation

You can install `repo2txt` using pip:

```sh
pip install git+https://github.com/blaisewf/repo2txt.git
```

Alternatively, you can clone the repository and install it locally:

```sh
git clone https://github.com/blaisewf/repo2txt.git
cd repo2txt
pip install .
```

> [!WARNING]  
> Git is required to clone the repository. If you don't have Git installed, you can download it from [git-scm.com](https://git-scm.com/).

## Usage

Once installed, you can use the CLI command `repo2txt` to process a GitHub repository. Here’s the basic syntax:

```sh
repo2txt --repo-url <repository_url> --output-file <output_file_path>
```

### Example

```sh
repo2txt --repo-url https://github.com/example/repository.git --output-file output.txt
```

This command will:

1. Clone the repository from `https://github.com/example/repository.git`.
2. Generate a text file `output.txt` containing the directory structure and contents of all files in the repository.
3. Clean up the cloned repository directory.

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

## References
- https://github.com/kirill-markin/repo-to-text