rolfedh-doc-utils 0.1.0__tar.gz → 0.1.3__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.
Files changed (38) hide show
  1. rolfedh_doc_utils-0.1.3/PKG-INFO +285 -0
  2. rolfedh_doc_utils-0.1.3/README.md +252 -0
  3. rolfedh_doc_utils-0.1.3/archive_unused_files.py +35 -0
  4. rolfedh_doc_utils-0.1.3/archive_unused_images.py +35 -0
  5. rolfedh_doc_utils-0.1.3/check_scannability.py +109 -0
  6. {rolfedh_doc_utils-0.1.0 → rolfedh_doc_utils-0.1.3}/doc_utils/file_utils.py +47 -3
  7. rolfedh_doc_utils-0.1.3/doc_utils/topic_map_parser.py +122 -0
  8. rolfedh_doc_utils-0.1.3/doc_utils/unused_adoc.py +50 -0
  9. rolfedh_doc_utils-0.1.3/find_unused_attributes.py +41 -0
  10. {rolfedh_doc_utils-0.1.0 → rolfedh_doc_utils-0.1.3}/pyproject.toml +6 -3
  11. rolfedh_doc_utils-0.1.3/rolfedh_doc_utils.egg-info/PKG-INFO +285 -0
  12. {rolfedh_doc_utils-0.1.0 → rolfedh_doc_utils-0.1.3}/rolfedh_doc_utils.egg-info/SOURCES.txt +13 -0
  13. rolfedh_doc_utils-0.1.3/rolfedh_doc_utils.egg-info/requires.txt +1 -0
  14. rolfedh_doc_utils-0.1.3/rolfedh_doc_utils.egg-info/top_level.txt +5 -0
  15. {rolfedh_doc_utils-0.1.0 → rolfedh_doc_utils-0.1.3}/tests/test_archive_unused_files.py +1 -0
  16. {rolfedh_doc_utils-0.1.0 → rolfedh_doc_utils-0.1.3}/tests/test_archive_unused_images.py +9 -4
  17. rolfedh_doc_utils-0.1.3/tests/test_cli_entry_points.py +348 -0
  18. rolfedh_doc_utils-0.1.3/tests/test_file_utils.py +350 -0
  19. rolfedh_doc_utils-0.1.3/tests/test_fixture_archive_unused_files.py +38 -0
  20. rolfedh_doc_utils-0.1.3/tests/test_fixture_archive_unused_images.py +45 -0
  21. rolfedh_doc_utils-0.1.3/tests/test_fixture_check_scannability.py +26 -0
  22. rolfedh_doc_utils-0.1.3/tests/test_parse_exclude_list.py +62 -0
  23. rolfedh_doc_utils-0.1.3/tests/test_topic_map_parser.py +190 -0
  24. rolfedh_doc_utils-0.1.0/PKG-INFO +0 -83
  25. rolfedh_doc_utils-0.1.0/README.md +0 -51
  26. rolfedh_doc_utils-0.1.0/doc_utils/unused_adoc.py +0 -24
  27. rolfedh_doc_utils-0.1.0/rolfedh_doc_utils.egg-info/PKG-INFO +0 -83
  28. rolfedh_doc_utils-0.1.0/rolfedh_doc_utils.egg-info/top_level.txt +0 -1
  29. {rolfedh_doc_utils-0.1.0 → rolfedh_doc_utils-0.1.3}/LICENSE +0 -0
  30. {rolfedh_doc_utils-0.1.0 → rolfedh_doc_utils-0.1.3}/doc_utils/__init__.py +0 -0
  31. {rolfedh_doc_utils-0.1.0 → rolfedh_doc_utils-0.1.3}/doc_utils/scannability.py +0 -0
  32. {rolfedh_doc_utils-0.1.0 → rolfedh_doc_utils-0.1.3}/doc_utils/unused_attributes.py +0 -0
  33. {rolfedh_doc_utils-0.1.0 → rolfedh_doc_utils-0.1.3}/doc_utils/unused_images.py +0 -0
  34. {rolfedh_doc_utils-0.1.0 → rolfedh_doc_utils-0.1.3}/rolfedh_doc_utils.egg-info/dependency_links.txt +0 -0
  35. {rolfedh_doc_utils-0.1.0 → rolfedh_doc_utils-0.1.3}/rolfedh_doc_utils.egg-info/entry_points.txt +0 -0
  36. {rolfedh_doc_utils-0.1.0 → rolfedh_doc_utils-0.1.3}/setup.cfg +0 -0
  37. {rolfedh_doc_utils-0.1.0 → rolfedh_doc_utils-0.1.3}/tests/test_check_scannability.py +0 -0
  38. {rolfedh_doc_utils-0.1.0 → rolfedh_doc_utils-0.1.3}/tests/test_unused_attributes.py +0 -0
@@ -0,0 +1,285 @@
1
+ Metadata-Version: 2.4
2
+ Name: rolfedh-doc-utils
3
+ Version: 0.1.3
4
+ Summary: CLI tools for AsciiDoc documentation projects
5
+ Author: Rolfe Dlugy-Hegwer
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 Rolfe Dlugy-Hegwer
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Requires-Python: >=3.8
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Requires-Dist: PyYAML>=6.0
32
+ Dynamic: license-file
33
+
34
+ # doc-utils
35
+
36
+ A set of Python utilities and CLI tools to help technical writers maintain AsciiDoc documentation repositories.
37
+
38
+ > ⚠️ **IMPORTANT: Safety First**
39
+ >
40
+ > These tools can modify or delete files in your documentation repository. Always:
41
+ > - **Work in a git branch** - Never run these tools on the main/master branch
42
+ > - **Review all changes carefully** - Use `git diff` or a pull request to verify modifications
43
+ > - **Check your preview builds** - Ensure no documentation errors were introduced
44
+
45
+ ## Resources
46
+
47
+ - [PyPI: rolfedh-doc-utils](https://pypi.org/project/rolfedh-doc-utils/)
48
+ - [GitHub repository](https://github.com/rolfedh/doc-utils)
49
+
50
+ ## Installation
51
+
52
+ ### From PyPI
53
+
54
+ On modern Linux distributions, you may encounter an "externally-managed-environment" error. Use one of these methods:
55
+
56
+ **Option 1: pipx (Recommended for CLI tools)**
57
+ ```sh
58
+ pipx install rolfedh-doc-utils
59
+ ```
60
+
61
+ **Option 2: pip with --user flag**
62
+ ```sh
63
+ pip install --user rolfedh-doc-utils
64
+ ```
65
+
66
+ **Option 3: Traditional pip (may require virtual environment)**
67
+ ```sh
68
+ pip install rolfedh-doc-utils
69
+ ```
70
+
71
+ ### Upgrading
72
+
73
+ To upgrade to the latest version:
74
+
75
+ ```sh
76
+ # If installed with pipx:
77
+ pipx upgrade rolfedh-doc-utils
78
+
79
+ # If installed with pip:
80
+ pip install --upgrade rolfedh-doc-utils # or --user flag if needed
81
+ ```
82
+
83
+ ### For Development
84
+
85
+ If you're developing or testing locally, install the package in editable mode:
86
+
87
+ ```sh
88
+ # Clone the repository
89
+ git clone https://github.com/rolfedh/doc-utils.git
90
+ cd doc-utils
91
+
92
+ # Install in editable mode
93
+ pip install -e .
94
+ ```
95
+
96
+ The following CLI tools are installed:
97
+
98
+ * `check-scannability`
99
+ * `archive-unused-files`
100
+ * `archive-unused-images`
101
+ * `find-unused-attributes`
102
+
103
+ These tools can be run from any directory.
104
+
105
+ ### Add to PATH (if needed)
106
+
107
+ By default, CLI tools install to:
108
+
109
+ ```sh
110
+ $HOME/.local/bin
111
+ ```
112
+
113
+ If this directory isn’t in your `PATH`, commands may not run. Append it to your shell configuration:
114
+
115
+ ```sh
116
+ echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc # or ~/.zshrc
117
+ ```
118
+
119
+ Then reload your shell:
120
+
121
+ ```sh
122
+ source ~/.bashrc # or ~/.zshrc
123
+ ```
124
+
125
+ ## CLI Tools Overview
126
+
127
+ ### `check-scannability`
128
+
129
+ Scans `.adoc` files in the current directory to report:
130
+
131
+ * Sentences that exceed a length limit (default: 22 words)
132
+ * Paragraphs with too many sentences (default: 3 sentences)
133
+ * Supports exclusion of files and directories
134
+
135
+ ➡️ See [`check_scannability.md`](https://github.com/rolfedh/doc-utils/blob/main/check_scannability.md) for details.
136
+
137
+ ---
138
+
139
+ ### `archive-unused-files`
140
+
141
+ Scans the `./modules` and `./assemblies` directories for `.adoc` files that are not referenced. Optionally archives and deletes them.
142
+
143
+ Works with both:
144
+ - **OpenShift-docs style** repositories (uses `_topic_maps/*.yml` files)
145
+ - **Traditional AsciiDoc** repositories (uses `master.adoc` files)
146
+
147
+ ➡️ See [`archive_unused_files.md`](https://github.com/rolfedh/doc-utils/blob/main/archive_unused_files.md).
148
+
149
+ ---
150
+
151
+ ### `archive-unused-images`
152
+
153
+ Finds unused image files (e.g., `.png`, `.jpg`, `.jpeg`, `.gif`, `.svg`) in the current directory and optionally archives and deletes them.
154
+
155
+ ➡️ See [`archive_unused_images.md`](https://github.com/rolfedh/doc-utils/blob/main/archive_unused_images.md).
156
+
157
+ ---
158
+
159
+ ### `find-unused-attributes`
160
+
161
+ Scans an attributes file (e.g., `attributes.adoc`) for unused attribute definitions across all `.adoc` files in the current directory.
162
+
163
+ ➡️ See [`find_unused_attributes.md`](https://github.com/rolfedh/doc-utils/blob/main/find_unused_attributes.md).
164
+
165
+ ## Best Practices for Safe Usage
166
+
167
+ ### Before Running Any Tool:
168
+
169
+ - **Create a feature branch:**
170
+ ```sh
171
+ git checkout -b doc-cleanup-$(date +%Y%m%d)
172
+ ```
173
+
174
+ - **Commit any pending changes:**
175
+ ```sh
176
+ git add -A && git commit -m "Save work before cleanup"
177
+ ```
178
+
179
+ - **Run tools in preview mode first:**
180
+ - For archive tools: Run without `--archive` to see what would be affected
181
+
182
+ - **Review all changes and preview builds**
183
+
184
+ - **Only merge after verification:**
185
+
186
+ ## Usage
187
+
188
+ To run the tools after installation:
189
+
190
+ ```sh
191
+ check-scannability --help
192
+ archive-unused-files --help
193
+ find-unused-attributes attributes.adoc
194
+ ```
195
+
196
+ Or run them directly from source:
197
+
198
+ ```sh
199
+ python3 check_scannability.py
200
+ python3 archive_unused_files.py
201
+ python3 find_unused_attributes.py attributes.adoc
202
+ ```
203
+
204
+ ### Directory/File Exclusion
205
+
206
+ All tools support excluding specific directories and files from scanning. You can use these options:
207
+
208
+ 1. **`--exclude-dir`** - Exclude specific directories (can be used multiple times):
209
+ ```sh
210
+ archive-unused-files --exclude-dir ./modules/temp --exclude-dir ./modules/old
211
+ ```
212
+
213
+ 2. **`--exclude-file`** - Exclude specific files (can be used multiple times):
214
+ ```sh
215
+ check-scannability --exclude-file ./README.adoc --exclude-file ./test.adoc
216
+ ```
217
+
218
+ 3. **`--exclude-list`** - Point to a text file containing exclusions:
219
+ ```sh
220
+ archive-unused-images --exclude-list .docutils-ignore
221
+ ```
222
+
223
+ The exclusion file format:
224
+ ```
225
+ # Comments are supported
226
+ ./modules/deprecated/
227
+ ./assemblies/archive/
228
+ ./images/temp/
229
+ specific-file.adoc
230
+ ```
231
+
232
+ **Note:** When you exclude a parent directory, all its subdirectories are automatically excluded. Symbolic links are never followed during scanning.
233
+
234
+ ## Troubleshooting
235
+
236
+ ### ModuleNotFoundError
237
+
238
+ If you see an error like `ModuleNotFoundError: No module named 'find_unused_attributes'`, this typically means:
239
+
240
+ 1. The package isn't installed. Run:
241
+ ```sh
242
+ pipx install rolfedh-doc-utils # or pip install --user rolfedh-doc-utils
243
+ ```
244
+
245
+ 2. You're trying to run the script directly without installation. Either:
246
+ - Install the package first (see Installation section)
247
+ - Run the script using Python directly:
248
+ ```sh
249
+ python3 find_unused_attributes.py attributes.adoc
250
+ ```
251
+
252
+ ### Command not found
253
+
254
+ If the command isn't found after installation, ensure `$HOME/.local/bin` is in your PATH (see "Add to PATH" section above).
255
+
256
+ ## Development
257
+
258
+ ### Running Tests
259
+
260
+ The project includes a comprehensive test suite. To run tests:
261
+
262
+ ```sh
263
+ # Install development dependencies
264
+ pip install -r requirements-dev.txt
265
+
266
+ # Run all tests
267
+ python -m pytest tests/
268
+
269
+ # Run with verbose output
270
+ python -m pytest tests/ -v
271
+ ```
272
+
273
+ ### Contributing
274
+
275
+ Contributions are welcome! Please ensure:
276
+ - All tests pass before submitting a PR
277
+ - New features include appropriate tests
278
+ - Code follows PEP 8 style guidelines
279
+ - Documentation is updated as needed
280
+
281
+ See [CONTRIBUTING.md](https://github.com/rolfedh/doc-utils/blob/main/CONTRIBUTING.md) for more details.
282
+
283
+ ## License
284
+
285
+ This project is licensed under the terms of the [LICENSE](https://github.com/rolfedh/doc-utils/blob/main/LICENSE).
@@ -0,0 +1,252 @@
1
+ # doc-utils
2
+
3
+ A set of Python utilities and CLI tools to help technical writers maintain AsciiDoc documentation repositories.
4
+
5
+ > ⚠️ **IMPORTANT: Safety First**
6
+ >
7
+ > These tools can modify or delete files in your documentation repository. Always:
8
+ > - **Work in a git branch** - Never run these tools on the main/master branch
9
+ > - **Review all changes carefully** - Use `git diff` or a pull request to verify modifications
10
+ > - **Check your preview builds** - Ensure no documentation errors were introduced
11
+
12
+ ## Resources
13
+
14
+ - [PyPI: rolfedh-doc-utils](https://pypi.org/project/rolfedh-doc-utils/)
15
+ - [GitHub repository](https://github.com/rolfedh/doc-utils)
16
+
17
+ ## Installation
18
+
19
+ ### From PyPI
20
+
21
+ On modern Linux distributions, you may encounter an "externally-managed-environment" error. Use one of these methods:
22
+
23
+ **Option 1: pipx (Recommended for CLI tools)**
24
+ ```sh
25
+ pipx install rolfedh-doc-utils
26
+ ```
27
+
28
+ **Option 2: pip with --user flag**
29
+ ```sh
30
+ pip install --user rolfedh-doc-utils
31
+ ```
32
+
33
+ **Option 3: Traditional pip (may require virtual environment)**
34
+ ```sh
35
+ pip install rolfedh-doc-utils
36
+ ```
37
+
38
+ ### Upgrading
39
+
40
+ To upgrade to the latest version:
41
+
42
+ ```sh
43
+ # If installed with pipx:
44
+ pipx upgrade rolfedh-doc-utils
45
+
46
+ # If installed with pip:
47
+ pip install --upgrade rolfedh-doc-utils # or --user flag if needed
48
+ ```
49
+
50
+ ### For Development
51
+
52
+ If you're developing or testing locally, install the package in editable mode:
53
+
54
+ ```sh
55
+ # Clone the repository
56
+ git clone https://github.com/rolfedh/doc-utils.git
57
+ cd doc-utils
58
+
59
+ # Install in editable mode
60
+ pip install -e .
61
+ ```
62
+
63
+ The following CLI tools are installed:
64
+
65
+ * `check-scannability`
66
+ * `archive-unused-files`
67
+ * `archive-unused-images`
68
+ * `find-unused-attributes`
69
+
70
+ These tools can be run from any directory.
71
+
72
+ ### Add to PATH (if needed)
73
+
74
+ By default, CLI tools install to:
75
+
76
+ ```sh
77
+ $HOME/.local/bin
78
+ ```
79
+
80
+ If this directory isn’t in your `PATH`, commands may not run. Append it to your shell configuration:
81
+
82
+ ```sh
83
+ echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc # or ~/.zshrc
84
+ ```
85
+
86
+ Then reload your shell:
87
+
88
+ ```sh
89
+ source ~/.bashrc # or ~/.zshrc
90
+ ```
91
+
92
+ ## CLI Tools Overview
93
+
94
+ ### `check-scannability`
95
+
96
+ Scans `.adoc` files in the current directory to report:
97
+
98
+ * Sentences that exceed a length limit (default: 22 words)
99
+ * Paragraphs with too many sentences (default: 3 sentences)
100
+ * Supports exclusion of files and directories
101
+
102
+ ➡️ See [`check_scannability.md`](https://github.com/rolfedh/doc-utils/blob/main/check_scannability.md) for details.
103
+
104
+ ---
105
+
106
+ ### `archive-unused-files`
107
+
108
+ Scans the `./modules` and `./assemblies` directories for `.adoc` files that are not referenced. Optionally archives and deletes them.
109
+
110
+ Works with both:
111
+ - **OpenShift-docs style** repositories (uses `_topic_maps/*.yml` files)
112
+ - **Traditional AsciiDoc** repositories (uses `master.adoc` files)
113
+
114
+ ➡️ See [`archive_unused_files.md`](https://github.com/rolfedh/doc-utils/blob/main/archive_unused_files.md).
115
+
116
+ ---
117
+
118
+ ### `archive-unused-images`
119
+
120
+ Finds unused image files (e.g., `.png`, `.jpg`, `.jpeg`, `.gif`, `.svg`) in the current directory and optionally archives and deletes them.
121
+
122
+ ➡️ See [`archive_unused_images.md`](https://github.com/rolfedh/doc-utils/blob/main/archive_unused_images.md).
123
+
124
+ ---
125
+
126
+ ### `find-unused-attributes`
127
+
128
+ Scans an attributes file (e.g., `attributes.adoc`) for unused attribute definitions across all `.adoc` files in the current directory.
129
+
130
+ ➡️ See [`find_unused_attributes.md`](https://github.com/rolfedh/doc-utils/blob/main/find_unused_attributes.md).
131
+
132
+ ## Best Practices for Safe Usage
133
+
134
+ ### Before Running Any Tool:
135
+
136
+ - **Create a feature branch:**
137
+ ```sh
138
+ git checkout -b doc-cleanup-$(date +%Y%m%d)
139
+ ```
140
+
141
+ - **Commit any pending changes:**
142
+ ```sh
143
+ git add -A && git commit -m "Save work before cleanup"
144
+ ```
145
+
146
+ - **Run tools in preview mode first:**
147
+ - For archive tools: Run without `--archive` to see what would be affected
148
+
149
+ - **Review all changes and preview builds**
150
+
151
+ - **Only merge after verification:**
152
+
153
+ ## Usage
154
+
155
+ To run the tools after installation:
156
+
157
+ ```sh
158
+ check-scannability --help
159
+ archive-unused-files --help
160
+ find-unused-attributes attributes.adoc
161
+ ```
162
+
163
+ Or run them directly from source:
164
+
165
+ ```sh
166
+ python3 check_scannability.py
167
+ python3 archive_unused_files.py
168
+ python3 find_unused_attributes.py attributes.adoc
169
+ ```
170
+
171
+ ### Directory/File Exclusion
172
+
173
+ All tools support excluding specific directories and files from scanning. You can use these options:
174
+
175
+ 1. **`--exclude-dir`** - Exclude specific directories (can be used multiple times):
176
+ ```sh
177
+ archive-unused-files --exclude-dir ./modules/temp --exclude-dir ./modules/old
178
+ ```
179
+
180
+ 2. **`--exclude-file`** - Exclude specific files (can be used multiple times):
181
+ ```sh
182
+ check-scannability --exclude-file ./README.adoc --exclude-file ./test.adoc
183
+ ```
184
+
185
+ 3. **`--exclude-list`** - Point to a text file containing exclusions:
186
+ ```sh
187
+ archive-unused-images --exclude-list .docutils-ignore
188
+ ```
189
+
190
+ The exclusion file format:
191
+ ```
192
+ # Comments are supported
193
+ ./modules/deprecated/
194
+ ./assemblies/archive/
195
+ ./images/temp/
196
+ specific-file.adoc
197
+ ```
198
+
199
+ **Note:** When you exclude a parent directory, all its subdirectories are automatically excluded. Symbolic links are never followed during scanning.
200
+
201
+ ## Troubleshooting
202
+
203
+ ### ModuleNotFoundError
204
+
205
+ If you see an error like `ModuleNotFoundError: No module named 'find_unused_attributes'`, this typically means:
206
+
207
+ 1. The package isn't installed. Run:
208
+ ```sh
209
+ pipx install rolfedh-doc-utils # or pip install --user rolfedh-doc-utils
210
+ ```
211
+
212
+ 2. You're trying to run the script directly without installation. Either:
213
+ - Install the package first (see Installation section)
214
+ - Run the script using Python directly:
215
+ ```sh
216
+ python3 find_unused_attributes.py attributes.adoc
217
+ ```
218
+
219
+ ### Command not found
220
+
221
+ If the command isn't found after installation, ensure `$HOME/.local/bin` is in your PATH (see "Add to PATH" section above).
222
+
223
+ ## Development
224
+
225
+ ### Running Tests
226
+
227
+ The project includes a comprehensive test suite. To run tests:
228
+
229
+ ```sh
230
+ # Install development dependencies
231
+ pip install -r requirements-dev.txt
232
+
233
+ # Run all tests
234
+ python -m pytest tests/
235
+
236
+ # Run with verbose output
237
+ python -m pytest tests/ -v
238
+ ```
239
+
240
+ ### Contributing
241
+
242
+ Contributions are welcome! Please ensure:
243
+ - All tests pass before submitting a PR
244
+ - New features include appropriate tests
245
+ - Code follows PEP 8 style guidelines
246
+ - Documentation is updated as needed
247
+
248
+ See [CONTRIBUTING.md](https://github.com/rolfedh/doc-utils/blob/main/CONTRIBUTING.md) for more details.
249
+
250
+ ## License
251
+
252
+ This project is licensed under the terms of the [LICENSE](https://github.com/rolfedh/doc-utils/blob/main/LICENSE).
@@ -0,0 +1,35 @@
1
+ """
2
+ Archive Unused AsciiDoc Files
3
+
4
+ Scans './modules' and './assemblies' for AsciiDoc files not referenced by any other AsciiDoc file in the project. Optionally archives and deletes them.
5
+
6
+ For full documentation and usage examples, see archive_unused_files.md in this directory.
7
+ """
8
+
9
+ import argparse
10
+ from doc_utils.unused_adoc import find_unused_adoc
11
+ from doc_utils.file_utils import parse_exclude_list_file
12
+
13
+ def main():
14
+ parser = argparse.ArgumentParser(description='Archive unused AsciiDoc files.')
15
+ parser.add_argument('--archive', action='store_true', help='Move the files to a dated zip in the archive directory.')
16
+ parser.add_argument('--exclude-dir', action='append', default=[], help='Directory to exclude (can be used multiple times).')
17
+ parser.add_argument('--exclude-file', action='append', default=[], help='File to exclude (can be used multiple times).')
18
+ parser.add_argument('--exclude-list', type=str, help='Path to a file containing directories or files to exclude, one per line.')
19
+ args = parser.parse_args()
20
+
21
+ scan_dirs = ['./modules', './modules/rn', './assemblies']
22
+ archive_dir = './archive'
23
+
24
+ exclude_dirs = list(args.exclude_dir)
25
+ exclude_files = list(args.exclude_file)
26
+
27
+ if args.exclude_list:
28
+ list_dirs, list_files = parse_exclude_list_file(args.exclude_list)
29
+ exclude_dirs.extend(list_dirs)
30
+ exclude_files.extend(list_files)
31
+
32
+ find_unused_adoc(scan_dirs, archive_dir, args.archive, exclude_dirs, exclude_files)
33
+
34
+ if __name__ == '__main__':
35
+ main()
@@ -0,0 +1,35 @@
1
+ """
2
+ Archive Unused Image Files
3
+
4
+ Scans './modules' and './assemblies' for image files (e.g., .png, .jpg, .jpeg, .gif, .svg) not referenced by any AsciiDoc file in the project. Optionally archives and deletes them.
5
+
6
+ For full documentation and usage examples, see archive_unused_files.md in this directory.
7
+ """
8
+
9
+ import argparse
10
+ from doc_utils.unused_images import find_unused_images
11
+ from doc_utils.file_utils import parse_exclude_list_file
12
+
13
+ def main():
14
+ parser = argparse.ArgumentParser(description='Archive unused image files.')
15
+ parser.add_argument('--archive', action='store_true', help='Move the files to a dated zip in the archive directory.')
16
+ parser.add_argument('--exclude-dir', action='append', default=[], help='Directory to exclude (can be used multiple times).')
17
+ parser.add_argument('--exclude-file', action='append', default=[], help='File to exclude (can be used multiple times).')
18
+ parser.add_argument('--exclude-list', type=str, help='Path to a file containing directories or files to exclude, one per line.')
19
+ args = parser.parse_args()
20
+
21
+ scan_dirs = ['.']
22
+ archive_dir = './archive'
23
+
24
+ exclude_dirs = list(args.exclude_dir)
25
+ exclude_files = list(args.exclude_file)
26
+
27
+ if args.exclude_list:
28
+ list_dirs, list_files = parse_exclude_list_file(args.exclude_list)
29
+ exclude_dirs.extend(list_dirs)
30
+ exclude_files.extend(list_files)
31
+
32
+ find_unused_images(scan_dirs, archive_dir, args.archive, exclude_dirs, exclude_files)
33
+
34
+ if __name__ == '__main__':
35
+ main()