snap2txt 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- snap2txt-0.2.2/LICENSE +21 -0
- snap2txt-0.2.2/PKG-INFO +116 -0
- snap2txt-0.2.2/README.md +91 -0
- snap2txt-0.2.2/setup.cfg +4 -0
- snap2txt-0.2.2/setup.py +31 -0
- snap2txt-0.2.2/snap2txt/.il +10 -0
- snap2txt-0.2.2/snap2txt/.wl +0 -0
- snap2txt-0.2.2/snap2txt/__init__.py +0 -0
- snap2txt-0.2.2/snap2txt/__main__.py +5 -0
- snap2txt-0.2.2/snap2txt/saver.py +188 -0
- snap2txt-0.2.2/snap2txt.egg-info/PKG-INFO +116 -0
- snap2txt-0.2.2/snap2txt.egg-info/SOURCES.txt +13 -0
- snap2txt-0.2.2/snap2txt.egg-info/dependency_links.txt +1 -0
- snap2txt-0.2.2/snap2txt.egg-info/entry_points.txt +2 -0
- snap2txt-0.2.2/snap2txt.egg-info/top_level.txt +1 -0
snap2txt-0.2.2/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Sérgio Vorniches
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
snap2txt-0.2.2/PKG-INFO
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: snap2txt
|
|
3
|
+
Version: 0.2.2
|
|
4
|
+
Summary: A tool to save project structure and contents to a text file
|
|
5
|
+
Home-page: https://github.com/vorniches/snap2txt
|
|
6
|
+
Author: Sergei Vorniches
|
|
7
|
+
Author-email: vorniches@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.6
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Dynamic: author
|
|
16
|
+
Dynamic: author-email
|
|
17
|
+
Dynamic: classifier
|
|
18
|
+
Dynamic: description
|
|
19
|
+
Dynamic: description-content-type
|
|
20
|
+
Dynamic: home-page
|
|
21
|
+
Dynamic: license
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
Dynamic: requires-python
|
|
24
|
+
Dynamic: summary
|
|
25
|
+
|
|
26
|
+
# Snap2Txt
|
|
27
|
+
|
|
28
|
+
Snap2Txt is a Python utility that captures the structure and contents of a project directory and saves them into a text file. It's designed for quick documentation of your project's file system.
|
|
29
|
+
|
|
30
|
+
## Features
|
|
31
|
+
|
|
32
|
+
- **Complete Capture**: Records the entire file structure and contents of the project.
|
|
33
|
+
- **Customizable Filters**: Offers ignore and whitelist options for targeted scanning.
|
|
34
|
+
- **Command-Line Interface**: Simple and easy-to-use command-line tool.
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
Install Snap2Txt with pip:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install snap2txt
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
> **Note**: The installation now automatically provides `.il` and `.wl` files along with the package.
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
Navigate to your project directory and run:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
snap2txt
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
By default, Snap2Txt will scan all files and directories in the current folder and produce an output file called `project_contents.txt`.
|
|
55
|
+
|
|
56
|
+
### Locate the .il and .wl Files
|
|
57
|
+
|
|
58
|
+
If you need to see where Snap2Txt’s `.il` and `.wl` files were installed on your system (e.g., to customize them), run:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
snap2txt --show-locations
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
This will print the full path to each file, so you can open or edit them as needed.
|
|
65
|
+
|
|
66
|
+
### Optional Flags
|
|
67
|
+
|
|
68
|
+
- `--il`: Use ignore list defined in `.il`.
|
|
69
|
+
- `--wl`: Use whitelist defined in `.wl`.
|
|
70
|
+
|
|
71
|
+
Example:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
snap2txt --il
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
snap2txt --wl
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Configuration
|
|
82
|
+
|
|
83
|
+
Snap2Txt respects two files for filtering:
|
|
84
|
+
|
|
85
|
+
1. **Ignore List (`.il`)**: Exclude certain files/directories.
|
|
86
|
+
2. **Whitelist (`.wl`)**: Include only certain files/directories.
|
|
87
|
+
|
|
88
|
+
By default, Snap2Txt installs a basic `.il` and `.wl` in the package directory. To tailor the behavior for your project, you can edit those files or replace them with your own custom rules.
|
|
89
|
+
|
|
90
|
+
> **Tip**: To quickly locate where these files were installed, use `snap2txt --show-locations`.
|
|
91
|
+
|
|
92
|
+
### Example `.il` File
|
|
93
|
+
|
|
94
|
+
```text
|
|
95
|
+
node_modules/
|
|
96
|
+
*.log
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Example `.wl` File
|
|
100
|
+
|
|
101
|
+
```text
|
|
102
|
+
*.py
|
|
103
|
+
*.md
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Contributing
|
|
107
|
+
|
|
108
|
+
Contributions to Snap2Txt are welcome! Feel free to fork the repository, make your changes, and submit a pull request.
|
|
109
|
+
|
|
110
|
+
## License
|
|
111
|
+
|
|
112
|
+
Snap2Txt is open-sourced software licensed under the [MIT license](LICENSE).
|
|
113
|
+
|
|
114
|
+
## Support
|
|
115
|
+
|
|
116
|
+
For support, questions, or feedback, please [open an issue](https://github.com/vorniches/snap2txt/issues) in the GitHub repository.
|
snap2txt-0.2.2/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Snap2Txt
|
|
2
|
+
|
|
3
|
+
Snap2Txt is a Python utility that captures the structure and contents of a project directory and saves them into a text file. It's designed for quick documentation of your project's file system.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Complete Capture**: Records the entire file structure and contents of the project.
|
|
8
|
+
- **Customizable Filters**: Offers ignore and whitelist options for targeted scanning.
|
|
9
|
+
- **Command-Line Interface**: Simple and easy-to-use command-line tool.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
Install Snap2Txt with pip:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install snap2txt
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
> **Note**: The installation now automatically provides `.il` and `.wl` files along with the package.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
Navigate to your project directory and run:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
snap2txt
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
By default, Snap2Txt will scan all files and directories in the current folder and produce an output file called `project_contents.txt`.
|
|
30
|
+
|
|
31
|
+
### Locate the .il and .wl Files
|
|
32
|
+
|
|
33
|
+
If you need to see where Snap2Txt’s `.il` and `.wl` files were installed on your system (e.g., to customize them), run:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
snap2txt --show-locations
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
This will print the full path to each file, so you can open or edit them as needed.
|
|
40
|
+
|
|
41
|
+
### Optional Flags
|
|
42
|
+
|
|
43
|
+
- `--il`: Use ignore list defined in `.il`.
|
|
44
|
+
- `--wl`: Use whitelist defined in `.wl`.
|
|
45
|
+
|
|
46
|
+
Example:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
snap2txt --il
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
snap2txt --wl
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Configuration
|
|
57
|
+
|
|
58
|
+
Snap2Txt respects two files for filtering:
|
|
59
|
+
|
|
60
|
+
1. **Ignore List (`.il`)**: Exclude certain files/directories.
|
|
61
|
+
2. **Whitelist (`.wl`)**: Include only certain files/directories.
|
|
62
|
+
|
|
63
|
+
By default, Snap2Txt installs a basic `.il` and `.wl` in the package directory. To tailor the behavior for your project, you can edit those files or replace them with your own custom rules.
|
|
64
|
+
|
|
65
|
+
> **Tip**: To quickly locate where these files were installed, use `snap2txt --show-locations`.
|
|
66
|
+
|
|
67
|
+
### Example `.il` File
|
|
68
|
+
|
|
69
|
+
```text
|
|
70
|
+
node_modules/
|
|
71
|
+
*.log
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Example `.wl` File
|
|
75
|
+
|
|
76
|
+
```text
|
|
77
|
+
*.py
|
|
78
|
+
*.md
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Contributing
|
|
82
|
+
|
|
83
|
+
Contributions to Snap2Txt are welcome! Feel free to fork the repository, make your changes, and submit a pull request.
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
Snap2Txt is open-sourced software licensed under the [MIT license](LICENSE).
|
|
88
|
+
|
|
89
|
+
## Support
|
|
90
|
+
|
|
91
|
+
For support, questions, or feedback, please [open an issue](https://github.com/vorniches/snap2txt/issues) in the GitHub repository.
|
snap2txt-0.2.2/setup.cfg
ADDED
snap2txt-0.2.2/setup.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name='snap2txt',
|
|
5
|
+
version='0.2.2',
|
|
6
|
+
packages=find_packages(),
|
|
7
|
+
entry_points={
|
|
8
|
+
'console_scripts': [
|
|
9
|
+
'snap2txt = snap2txt.__main__:main'
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
include_package_data=True,
|
|
13
|
+
package_data={
|
|
14
|
+
'snap2txt': ['.il', '.wl'],
|
|
15
|
+
},
|
|
16
|
+
author='Sergei Vorniches',
|
|
17
|
+
author_email='vorniches@gmail.com',
|
|
18
|
+
description='A tool to save project structure and contents to a text file',
|
|
19
|
+
long_description=open('README.md').read(),
|
|
20
|
+
long_description_content_type='text/markdown',
|
|
21
|
+
url='https://github.com/vorniches/snap2txt',
|
|
22
|
+
license='MIT',
|
|
23
|
+
install_requires=[
|
|
24
|
+
],
|
|
25
|
+
classifiers=[
|
|
26
|
+
'Programming Language :: Python :: 3',
|
|
27
|
+
'License :: OSI Approved :: MIT License',
|
|
28
|
+
'Operating System :: OS Independent',
|
|
29
|
+
],
|
|
30
|
+
python_requires='>=3.6',
|
|
31
|
+
)
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import argparse
|
|
4
|
+
import fnmatch
|
|
5
|
+
|
|
6
|
+
def read_list_file(file_path):
|
|
7
|
+
"""
|
|
8
|
+
Read a list file (.il or .wl) and return the list of patterns.
|
|
9
|
+
"""
|
|
10
|
+
try:
|
|
11
|
+
with open(file_path, 'r') as file:
|
|
12
|
+
return [line.strip() for line in file if line.strip()]
|
|
13
|
+
except FileNotFoundError:
|
|
14
|
+
print(f"List file not found: {file_path}")
|
|
15
|
+
return []
|
|
16
|
+
|
|
17
|
+
def match_pattern(path, patterns, is_dir=False):
|
|
18
|
+
"""
|
|
19
|
+
Check if a given path matches any of the patterns in the list.
|
|
20
|
+
Supports:
|
|
21
|
+
- Folder patterns ending with / (e.g., "node_modules/")
|
|
22
|
+
- File extension patterns (e.g., "*.css", ".jpg")
|
|
23
|
+
- Wildcards (e.g., "test*.js")
|
|
24
|
+
- Full path patterns (e.g., "lib/realtime-client.ts")
|
|
25
|
+
- Exact names (e.g., "package.json")
|
|
26
|
+
- Substring patterns (e.g., "__pycache__")
|
|
27
|
+
"""
|
|
28
|
+
if not patterns:
|
|
29
|
+
return False
|
|
30
|
+
|
|
31
|
+
# Normalize path separators
|
|
32
|
+
path = path.replace("\\", "/")
|
|
33
|
+
path_parts = path.split("/")
|
|
34
|
+
basename = os.path.basename(path)
|
|
35
|
+
|
|
36
|
+
for pattern in patterns:
|
|
37
|
+
# Normalize pattern
|
|
38
|
+
pattern = pattern.replace("\\", "/")
|
|
39
|
+
|
|
40
|
+
# Pattern for directories (ends with /)
|
|
41
|
+
if pattern.endswith("/"):
|
|
42
|
+
dir_pattern = pattern.rstrip("/")
|
|
43
|
+
if is_dir:
|
|
44
|
+
# Check if any part of the path matches the directory name
|
|
45
|
+
if dir_pattern in path_parts or basename == dir_pattern:
|
|
46
|
+
return True
|
|
47
|
+
else:
|
|
48
|
+
# For files, check if any parent directory matches
|
|
49
|
+
if dir_pattern in path_parts:
|
|
50
|
+
return True
|
|
51
|
+
|
|
52
|
+
# Pattern for file extensions (e.g., ".css", "*.css")
|
|
53
|
+
elif pattern.startswith("*."):
|
|
54
|
+
ext = pattern[1:] # Remove the *
|
|
55
|
+
if basename.endswith(ext):
|
|
56
|
+
return True
|
|
57
|
+
|
|
58
|
+
elif pattern.startswith(".") and not pattern.startswith("./"):
|
|
59
|
+
# Extension pattern like ".css"
|
|
60
|
+
if basename.endswith(pattern):
|
|
61
|
+
return True
|
|
62
|
+
|
|
63
|
+
# Wildcard pattern (e.g., "test*.js")
|
|
64
|
+
elif "*" in pattern:
|
|
65
|
+
if fnmatch.fnmatch(basename, pattern):
|
|
66
|
+
return True
|
|
67
|
+
|
|
68
|
+
# Full path match (e.g., "lib/realtime-client.ts")
|
|
69
|
+
elif "/" in pattern:
|
|
70
|
+
if pattern == path or path.endswith("/" + pattern):
|
|
71
|
+
return True
|
|
72
|
+
|
|
73
|
+
# Exact basename match
|
|
74
|
+
elif pattern == basename:
|
|
75
|
+
return True
|
|
76
|
+
|
|
77
|
+
# Substring match in path parts (for patterns like "__pycache__")
|
|
78
|
+
elif pattern in path_parts:
|
|
79
|
+
return True
|
|
80
|
+
|
|
81
|
+
return False
|
|
82
|
+
|
|
83
|
+
def should_include_path(path, is_dir, ignore_list, whitelist, whitelist_mode):
|
|
84
|
+
"""
|
|
85
|
+
Determine if a path should be included based on ignore list and whitelist.
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
path: The file or directory path
|
|
89
|
+
is_dir: Whether the path is a directory
|
|
90
|
+
ignore_list: List of patterns to ignore
|
|
91
|
+
whitelist: List of patterns to include
|
|
92
|
+
whitelist_mode: If True, ONLY include whitelisted items (ignore ignore_list)
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
True if the path should be included, False otherwise
|
|
96
|
+
"""
|
|
97
|
+
if whitelist_mode:
|
|
98
|
+
# In whitelist mode, ONLY include items that match the whitelist
|
|
99
|
+
return match_pattern(path, whitelist, is_dir)
|
|
100
|
+
else:
|
|
101
|
+
# In normal mode, include everything except ignored items
|
|
102
|
+
# If whitelist exists in non-whitelist mode, it acts as an additional filter
|
|
103
|
+
if ignore_list and match_pattern(path, ignore_list, is_dir):
|
|
104
|
+
return False
|
|
105
|
+
if whitelist and not match_pattern(path, whitelist, is_dir):
|
|
106
|
+
return False
|
|
107
|
+
return True
|
|
108
|
+
|
|
109
|
+
def save_project_structure_and_files(root_path, output_file, ignore_list=None, whitelist=None, whitelist_mode=False):
|
|
110
|
+
"""
|
|
111
|
+
Save the project structure and contents of all files in the project to a text file,
|
|
112
|
+
considering ignore and whitelist.
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
root_path: The root directory to scan
|
|
116
|
+
output_file: The output file path
|
|
117
|
+
ignore_list: List of patterns to ignore
|
|
118
|
+
whitelist: List of patterns to include
|
|
119
|
+
whitelist_mode: If True, ONLY include whitelisted items (ignore ignore_list)
|
|
120
|
+
"""
|
|
121
|
+
project_structure = []
|
|
122
|
+
file_contents = []
|
|
123
|
+
|
|
124
|
+
for root, dirs, files in os.walk(root_path):
|
|
125
|
+
rel_dir = os.path.relpath(root, root_path)
|
|
126
|
+
|
|
127
|
+
# Filter directories
|
|
128
|
+
# In whitelist mode, traverse all directories but only filter files
|
|
129
|
+
# In normal mode, filter directories to avoid traversing ignored ones
|
|
130
|
+
if not whitelist_mode:
|
|
131
|
+
filtered_dirs = []
|
|
132
|
+
for d in dirs:
|
|
133
|
+
dir_path = os.path.join(rel_dir, d) if rel_dir != "." else d
|
|
134
|
+
if should_include_path(dir_path, True, ignore_list, whitelist, whitelist_mode):
|
|
135
|
+
filtered_dirs.append(d)
|
|
136
|
+
dirs[:] = filtered_dirs
|
|
137
|
+
|
|
138
|
+
# Filter and process files
|
|
139
|
+
for file in files:
|
|
140
|
+
file_path = os.path.join(rel_dir, file) if rel_dir != "." else file
|
|
141
|
+
|
|
142
|
+
if should_include_path(file_path, False, ignore_list, whitelist, whitelist_mode):
|
|
143
|
+
rel_file = file_path.replace("\\", "/")
|
|
144
|
+
project_structure.append(rel_file)
|
|
145
|
+
|
|
146
|
+
try:
|
|
147
|
+
with open(os.path.join(root, file), 'r', encoding='utf-8') as f:
|
|
148
|
+
content = f.read()
|
|
149
|
+
file_contents.append(f"{file}:\n```\n{content}\n```\n")
|
|
150
|
+
except Exception as e:
|
|
151
|
+
file_contents.append(f"{file}:\n```\nError reading file: {e}\n```\n")
|
|
152
|
+
|
|
153
|
+
with open(output_file, 'w', encoding='utf-8') as f:
|
|
154
|
+
f.write("Project Structure:\n")
|
|
155
|
+
f.write("\n".join(project_structure) + "\n\n")
|
|
156
|
+
f.write("File Contents:\n")
|
|
157
|
+
f.write("\n".join(file_contents))
|
|
158
|
+
|
|
159
|
+
print(f"Project contents saved to {output_file}")
|
|
160
|
+
print(f"Total files collected: {len(project_structure)}")
|
|
161
|
+
|
|
162
|
+
def main():
|
|
163
|
+
script_dir = os.path.dirname(__file__)
|
|
164
|
+
il_file = os.path.join(script_dir, '.il')
|
|
165
|
+
wl_file = os.path.join(script_dir, '.wl')
|
|
166
|
+
|
|
167
|
+
parser = argparse.ArgumentParser(description="Save project structure and file contents.")
|
|
168
|
+
parser.add_argument("--il", help="Use ignore list (.il file)", action="store_true")
|
|
169
|
+
parser.add_argument("--wl", help="Use whitelist (.wl file) - ONLY collect whitelisted items", action="store_true")
|
|
170
|
+
parser.add_argument("--show-locations", help="Show the location of the .il and .wl files", action="store_true")
|
|
171
|
+
|
|
172
|
+
args = parser.parse_args()
|
|
173
|
+
|
|
174
|
+
if args.show_locations:
|
|
175
|
+
print("IL file is located at:", il_file)
|
|
176
|
+
print("WL file is located at:", wl_file)
|
|
177
|
+
sys.exit(0)
|
|
178
|
+
|
|
179
|
+
ignore_list = read_list_file(il_file) if args.il else None
|
|
180
|
+
whitelist = read_list_file(wl_file) if args.wl else None
|
|
181
|
+
|
|
182
|
+
# Whitelist mode: when --wl is used, ONLY collect whitelisted items
|
|
183
|
+
whitelist_mode = args.wl
|
|
184
|
+
|
|
185
|
+
save_project_structure_and_files('.', 'project_contents.txt', ignore_list, whitelist, whitelist_mode)
|
|
186
|
+
|
|
187
|
+
if __name__ == '__main__':
|
|
188
|
+
main()
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: snap2txt
|
|
3
|
+
Version: 0.2.2
|
|
4
|
+
Summary: A tool to save project structure and contents to a text file
|
|
5
|
+
Home-page: https://github.com/vorniches/snap2txt
|
|
6
|
+
Author: Sergei Vorniches
|
|
7
|
+
Author-email: vorniches@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.6
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Dynamic: author
|
|
16
|
+
Dynamic: author-email
|
|
17
|
+
Dynamic: classifier
|
|
18
|
+
Dynamic: description
|
|
19
|
+
Dynamic: description-content-type
|
|
20
|
+
Dynamic: home-page
|
|
21
|
+
Dynamic: license
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
Dynamic: requires-python
|
|
24
|
+
Dynamic: summary
|
|
25
|
+
|
|
26
|
+
# Snap2Txt
|
|
27
|
+
|
|
28
|
+
Snap2Txt is a Python utility that captures the structure and contents of a project directory and saves them into a text file. It's designed for quick documentation of your project's file system.
|
|
29
|
+
|
|
30
|
+
## Features
|
|
31
|
+
|
|
32
|
+
- **Complete Capture**: Records the entire file structure and contents of the project.
|
|
33
|
+
- **Customizable Filters**: Offers ignore and whitelist options for targeted scanning.
|
|
34
|
+
- **Command-Line Interface**: Simple and easy-to-use command-line tool.
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
Install Snap2Txt with pip:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install snap2txt
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
> **Note**: The installation now automatically provides `.il` and `.wl` files along with the package.
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
Navigate to your project directory and run:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
snap2txt
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
By default, Snap2Txt will scan all files and directories in the current folder and produce an output file called `project_contents.txt`.
|
|
55
|
+
|
|
56
|
+
### Locate the .il and .wl Files
|
|
57
|
+
|
|
58
|
+
If you need to see where Snap2Txt’s `.il` and `.wl` files were installed on your system (e.g., to customize them), run:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
snap2txt --show-locations
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
This will print the full path to each file, so you can open or edit them as needed.
|
|
65
|
+
|
|
66
|
+
### Optional Flags
|
|
67
|
+
|
|
68
|
+
- `--il`: Use ignore list defined in `.il`.
|
|
69
|
+
- `--wl`: Use whitelist defined in `.wl`.
|
|
70
|
+
|
|
71
|
+
Example:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
snap2txt --il
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
snap2txt --wl
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Configuration
|
|
82
|
+
|
|
83
|
+
Snap2Txt respects two files for filtering:
|
|
84
|
+
|
|
85
|
+
1. **Ignore List (`.il`)**: Exclude certain files/directories.
|
|
86
|
+
2. **Whitelist (`.wl`)**: Include only certain files/directories.
|
|
87
|
+
|
|
88
|
+
By default, Snap2Txt installs a basic `.il` and `.wl` in the package directory. To tailor the behavior for your project, you can edit those files or replace them with your own custom rules.
|
|
89
|
+
|
|
90
|
+
> **Tip**: To quickly locate where these files were installed, use `snap2txt --show-locations`.
|
|
91
|
+
|
|
92
|
+
### Example `.il` File
|
|
93
|
+
|
|
94
|
+
```text
|
|
95
|
+
node_modules/
|
|
96
|
+
*.log
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Example `.wl` File
|
|
100
|
+
|
|
101
|
+
```text
|
|
102
|
+
*.py
|
|
103
|
+
*.md
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Contributing
|
|
107
|
+
|
|
108
|
+
Contributions to Snap2Txt are welcome! Feel free to fork the repository, make your changes, and submit a pull request.
|
|
109
|
+
|
|
110
|
+
## License
|
|
111
|
+
|
|
112
|
+
Snap2Txt is open-sourced software licensed under the [MIT license](LICENSE).
|
|
113
|
+
|
|
114
|
+
## Support
|
|
115
|
+
|
|
116
|
+
For support, questions, or feedback, please [open an issue](https://github.com/vorniches/snap2txt/issues) in the GitHub repository.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
snap2txt/.il
|
|
5
|
+
snap2txt/.wl
|
|
6
|
+
snap2txt/__init__.py
|
|
7
|
+
snap2txt/__main__.py
|
|
8
|
+
snap2txt/saver.py
|
|
9
|
+
snap2txt.egg-info/PKG-INFO
|
|
10
|
+
snap2txt.egg-info/SOURCES.txt
|
|
11
|
+
snap2txt.egg-info/dependency_links.txt
|
|
12
|
+
snap2txt.egg-info/entry_points.txt
|
|
13
|
+
snap2txt.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
snap2txt
|