zipmind-cli 0.1.0__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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Senuda Dilvan
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.
@@ -0,0 +1,8 @@
1
+ Metadata-Version: 2.4
2
+ Name: zipmind-cli
3
+ Version: 0.1.0
4
+ Summary: A CLI tool to clean unwanted folders from zip files
5
+ Author: Your Name
6
+ Requires-Python: >=3.8
7
+ License-File: LICENSE
8
+ Dynamic: license-file
@@ -0,0 +1,85 @@
1
+ # Zip Cleaner ๐Ÿงน
2
+
3
+ [![Python Version](https://img.shields.io/badge/python-3.8%2B-blue.svg)](https://www.python.org/)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ A lightweight and efficient CLI tool to clean unwanted folders and files from ZIP archives. Perfect for removing build artifacts, temporary folders, or sensitive data before sharing your zip files.
7
+
8
+ ## ๐ŸŒŸ Features
9
+
10
+ - **Multi-folder removal**: Remove multiple folders or file patterns in one go.
11
+ - **Efficient processing**: Rebuilds the zip without extracting files to disk.
12
+ - **Simple CLI**: Easy-to-use command-line interface.
13
+ - **Custom Output**: Specify the name of the cleaned zip file.
14
+
15
+ ## ๐Ÿš€ Installation
16
+
17
+ You can install Zip Cleaner directly from the source:
18
+
19
+ ```bash
20
+ git clone https://github.com/senuda-d/zip-cleaner.git
21
+ cd zip-cleaner
22
+ pip install .
23
+ ```
24
+
25
+ ## ๐Ÿ›  Usage
26
+
27
+ Once installed, you can use the `zip-cleaner` command:
28
+
29
+ ```bash
30
+ zip-cleaner <zip_file> --remove <folder1> <folder2> ... [--output <output_file>]
31
+ ```
32
+
33
+ ### Options:
34
+
35
+ - `zipfile`: Path to the zip file you want to clean.
36
+ - `--remove`: One or more folder/file patterns to remove (required).
37
+ - `--output`: Name of the output zip file (default: `cleaned.zip`).
38
+
39
+ ### Examples
40
+
41
+ **Remove a single folder:**
42
+ ```bash
43
+ zip-cleaner project.zip --remove node_modules
44
+ ```
45
+
46
+ **Remove multiple folders:**
47
+ ```bash
48
+ zip-cleaner archive.zip --remove .git __pycache__ venv
49
+ ```
50
+
51
+ **Specify a custom output name:**
52
+ ```bash
53
+ zip-cleaner data.zip --remove temp --output data_clean.zip
54
+ ```
55
+
56
+ ## ๐Ÿ“‚ Project Structure
57
+
58
+ ```text
59
+ zip-cleaner/
60
+ โ”œโ”€โ”€ zip_cleaner/ # Main package
61
+ โ”‚ โ”œโ”€โ”€ cli.py # Command-line interface
62
+ โ”‚ โ”œโ”€โ”€ filter.py # Filtering logic
63
+ โ”‚ โ”œโ”€โ”€ reader.py # Zip reading utilities
64
+ โ”‚ โ””โ”€โ”€ rebuilder.py # Zip creation utilities
65
+ โ”œโ”€โ”€ main.py # Local entry point
66
+ โ”œโ”€โ”€ pyproject.toml # Project metadata and dependencies
67
+ โ””โ”€โ”€ LICENSE # MIT License
68
+ ```
69
+
70
+ ## ๐Ÿค Contributing
71
+
72
+ Contributions are welcome! Please feel free to submit a Pull Request.
73
+
74
+ 1. Fork the Project
75
+ 2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
76
+ 3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
77
+ 4. Push to the Branch (`git push origin feature/AmazingFeature`)
78
+ 5. Open a Pull Request
79
+
80
+ ## ๐Ÿ“„ License
81
+
82
+ Distributed under the MIT License. See `LICENSE` for more information.
83
+
84
+ ---
85
+ Created with โค๏ธ by [Senuda Dilvan](https://github.com/senuda-d)
@@ -0,0 +1,11 @@
1
+ [project]
2
+ name = "zipmind-cli"
3
+ version = "0.1.0"
4
+ description = "A CLI tool to clean unwanted folders from zip files"
5
+ authors = [
6
+ {name = "Your Name"}
7
+ ]
8
+ requires-python = ">=3.8"
9
+
10
+ [project.scripts]
11
+ zip-cleaner = "zip_cleaner.cli:main"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes
@@ -0,0 +1,44 @@
1
+ import argparse
2
+
3
+ from zip_cleaner.reader import list_zip_contents
4
+ from zip_cleaner.filter import filter_files
5
+ from zip_cleaner.rebuilder import create_clean_zip
6
+
7
+
8
+ def main():
9
+ parser = argparse.ArgumentParser(
10
+ description="Clean unwanted folders from zip files"
11
+ )
12
+
13
+ parser.add_argument(
14
+ "zipfile",
15
+ help="Path to the zip file"
16
+ )
17
+
18
+ parser.add_argument(
19
+ "--remove",
20
+ nargs="+",
21
+ required=True,
22
+ help="Folders to remove"
23
+ )
24
+
25
+ parser.add_argument(
26
+ "--output",
27
+ default="cleaned.zip",
28
+ help="Output zip file name"
29
+ )
30
+
31
+ args = parser.parse_args()
32
+
33
+ files = list_zip_contents(args.zipfile)
34
+
35
+ if files:
36
+ cleaned_files = filter_files(files, args.remove)
37
+
38
+ create_clean_zip(
39
+ args.zipfile,
40
+ cleaned_files,
41
+ args.output
42
+ )
43
+
44
+ print("\nProcess completed successfully!")
@@ -0,0 +1,18 @@
1
+ def filter_files(file_list, remove_folders):
2
+ filtered = []
3
+
4
+ for file in file_list:
5
+
6
+ should_skip = False
7
+
8
+ for folder in remove_folders:
9
+ if folder in file:
10
+ should_skip = True
11
+ break
12
+
13
+ if should_skip:
14
+ continue
15
+
16
+ filtered.append(file)
17
+
18
+ return filtered
@@ -0,0 +1,10 @@
1
+ import zipfile
2
+
3
+ def list_zip_contents(zip_path):
4
+ try:
5
+ with zipfile.ZipFile(zip_path, 'r') as zip_ref:
6
+ return zip_ref.namelist()
7
+ except FileNotFoundError:
8
+ print("Error: Zip file not found.")
9
+ except zipfile.BadZipFile:
10
+ print("Error: Invalid zip file.")
@@ -0,0 +1,17 @@
1
+ import zipfile
2
+
3
+
4
+ def create_clean_zip(zip_path, cleaned_files, output_name="cleaned.zip"):
5
+ try:
6
+ with zipfile.ZipFile(zip_path, 'r') as zip_in:
7
+ with zipfile.ZipFile(output_name, 'w') as zip_out:
8
+
9
+ for file in cleaned_files:
10
+ data = zip_in.read(file)
11
+ zip_out.writestr(file, data)
12
+ print(f"Cleaned zip created: {output_name}")
13
+
14
+ except FileNotFoundError:
15
+ print("Error: Original zip file not found.")
16
+ except zipfile.BadZipFile:
17
+ print("Error: Invalid zip file.")
@@ -0,0 +1,8 @@
1
+ Metadata-Version: 2.4
2
+ Name: zipmind-cli
3
+ Version: 0.1.0
4
+ Summary: A CLI tool to clean unwanted folders from zip files
5
+ Author: Your Name
6
+ Requires-Python: >=3.8
7
+ License-File: LICENSE
8
+ Dynamic: license-file
@@ -0,0 +1,13 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ zip_cleaner/__init__.py
5
+ zip_cleaner/cli.py
6
+ zip_cleaner/filter.py
7
+ zip_cleaner/reader.py
8
+ zip_cleaner/rebuilder.py
9
+ zipmind_cli.egg-info/PKG-INFO
10
+ zipmind_cli.egg-info/SOURCES.txt
11
+ zipmind_cli.egg-info/dependency_links.txt
12
+ zipmind_cli.egg-info/entry_points.txt
13
+ zipmind_cli.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ zip-cleaner = zip_cleaner.cli:main
@@ -0,0 +1 @@
1
+ zip_cleaner