strindex 3.2.0__tar.gz → 3.3.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.
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: strindex
3
- Version: 3.2.0
4
- Summary: A command line utility to view, edit and patch strings in PE files, with a focus on compatibility and translation.
3
+ Version: 3.3.0
4
+ Summary: A command line utility to extract and patch strings of various filetypes, with a focus on compatibility and translation.
5
5
  Home-page: https://github.com/zWolfrost/strindex
6
6
  Author: zWolfrost
7
7
  Author-email: zwolfrost@gmail.com
@@ -18,46 +18,48 @@ Provides-Extra: spellcheck
18
18
  License-File: LICENSE
19
19
 
20
20
  # strindex
21
- A command line utility to view, edit and patch strings in PE files, with a focus on compatibility and translation.
21
+ [![PyPI version](https://img.shields.io/pypi/v/strindex?label=PyPI%20version)](https://pypi.org/project/strindex/)
22
+ [![PyPI downloads](https://img.shields.io/pypi/dm/strindex?label=PyPI%20downloads)](https://pypi.org/project/strindex/)
23
+ [![GitHub downloads](https://img.shields.io/github/downloads/zWolfrost/strindex/total?label=GitHub%20downloads)](https://github.com/zWolfrost/strindex/releases/latest)
24
+ [![license](https://img.shields.io/github/license/zWolfrost/strindex)](LICENSE)
22
25
 
23
- This script will allow you to replace strings in PE files (".exe", ".dll" etc.) with other strings. It is useful for changing the text of a program without having to recompile it, for example, to translate a program into another language.
26
+ A command line utility to extract and patch strings of various filetypes, with a focus on compatibility and translation.
24
27
 
25
- Apart from using offsets to replace strings, it also has an option to use the original string itself to ensure compatibility with different versions of the same program.
28
+ This utility will allow you to replace strings in supported filetypes with other strings. It's useful to change the text of a program without having to recompile it, for example, to translate a program into another language.
26
29
 
27
- It also has a lot of features to help with translation, such as spellchecking & filtering strings by length and character set.
30
+ Apart from using offsets to replace strings, there's also an option to use the original string itself to ensure compatibility with different versions of the same program.
28
31
 
29
- The release includes a precompiled version of the program, which ONLY does the patching. If you want to use the other features, you will need to install Python 3.6 or later and the required libraries.
32
+ There are a lot of features to help with translation, such as spellchecking & filtering strings by length and character set.
30
33
 
31
- ## Requirements
32
- You can install the required libraries with the command `pip install [library name]`.
34
+ The release includes a precompiled version of the program, which ONLY does the patching. If you want to use the other features, you will need to install Python 3.6 or later and the required libraries.
33
35
 
34
- **Required**:
35
- - Python 3.6 or later.
36
- - `pefile` library.
36
+ ## Supported filetypes
37
+ *Support for more types won't be added unless I find some motivation to...*
38
+ - PE files (".exe, ".dll"...)
39
+ - Gamemaker data file ("data.win")
37
40
 
38
- **Optional**:
39
- - `lingua` library for filtering by detected language.
40
- - `language-tool-python` library for spellchecking.
41
+ ## Installation
42
+ You can install the program with the command `pip install strindex`.
41
43
 
42
44
  ## Usage
43
- There are four available actions:
45
+ You can run the program with the command `strindex <action> <input file(s)> [options]`.
46
+
47
+ These are the available actions:
44
48
  - `create`: Create a list of strings from a PE file (a strindex). Use `-c` to create a strindex that uses the original strings as references.
45
49
  - `patch`: Patch a PE file with a strindex.
50
+ - `patch_gui`: Patch a PE file with a strindex using a GUI.
46
51
  - `filter`: Filter a strindex by detected language, wordlist or length. You can specify those in the strindex settings.
47
- - `update`: Update a strindex pointers to match the new ones of a file, useful for when the file is modified (e.g. update)
48
52
  - `delta`: Create a delta file between two strindexes, that only contains the lines of the first strindex missing in the second one.
49
53
  - `spellcheck`: Spellcheck a strindex. You can specify the target language in the strindex settings as an ISO 639-1 code.
50
54
 
51
- You can run the program with the command `python strindex.py -h` to show all available arguments.
52
-
53
55
  ## Usage Examples
54
56
  - Create a strindex from a PE file:
55
57
  ```sh
56
- python strindex.py create program.exe -o strindex.txt
58
+ strindex create program.exe -o strindex.txt
57
59
  ```
58
60
  - Patch a PE file with a strindex:
59
61
  ```sh
60
- python strindex.py patch program.exe strindex.txt
62
+ strindex patch program.exe strindex.txt
61
63
  ```
62
64
 
63
65
  ## Strindex Settings example
@@ -0,0 +1,67 @@
1
+ # strindex
2
+ [![PyPI version](https://img.shields.io/pypi/v/strindex?label=PyPI%20version)](https://pypi.org/project/strindex/)
3
+ [![PyPI downloads](https://img.shields.io/pypi/dm/strindex?label=PyPI%20downloads)](https://pypi.org/project/strindex/)
4
+ [![GitHub downloads](https://img.shields.io/github/downloads/zWolfrost/strindex/total?label=GitHub%20downloads)](https://github.com/zWolfrost/strindex/releases/latest)
5
+ [![license](https://img.shields.io/github/license/zWolfrost/strindex)](LICENSE)
6
+
7
+ A command line utility to extract and patch strings of various filetypes, with a focus on compatibility and translation.
8
+
9
+ This utility will allow you to replace strings in supported filetypes with other strings. It's useful to change the text of a program without having to recompile it, for example, to translate a program into another language.
10
+
11
+ Apart from using offsets to replace strings, there's also an option to use the original string itself to ensure compatibility with different versions of the same program.
12
+
13
+ There are a lot of features to help with translation, such as spellchecking & filtering strings by length and character set.
14
+
15
+ The release includes a precompiled version of the program, which ONLY does the patching. If you want to use the other features, you will need to install Python 3.6 or later and the required libraries.
16
+
17
+ ## Supported filetypes
18
+ *Support for more types won't be added unless I find some motivation to...*
19
+ - PE files (".exe, ".dll"...)
20
+ - Gamemaker data file ("data.win")
21
+
22
+ ## Installation
23
+ You can install the program with the command `pip install strindex`.
24
+
25
+ ## Usage
26
+ You can run the program with the command `strindex <action> <input file(s)> [options]`.
27
+
28
+ These are the available actions:
29
+ - `create`: Create a list of strings from a PE file (a strindex). Use `-c` to create a strindex that uses the original strings as references.
30
+ - `patch`: Patch a PE file with a strindex.
31
+ - `patch_gui`: Patch a PE file with a strindex using a GUI.
32
+ - `filter`: Filter a strindex by detected language, wordlist or length. You can specify those in the strindex settings.
33
+ - `delta`: Create a delta file between two strindexes, that only contains the lines of the first strindex missing in the second one.
34
+ - `spellcheck`: Spellcheck a strindex. You can specify the target language in the strindex settings as an ISO 639-1 code.
35
+
36
+ ## Usage Examples
37
+ - Create a strindex from a PE file:
38
+ ```sh
39
+ strindex create program.exe -o strindex.txt
40
+ ```
41
+ - Patch a PE file with a strindex:
42
+ ```sh
43
+ strindex patch program.exe strindex.txt
44
+ ```
45
+
46
+ ## Strindex Settings example
47
+ ```json
48
+ {
49
+ "md5": "29ed1f9e450d43815c2d1a0cab168da3",
50
+
51
+ "prefix_bytes": ["24c7442404", "ec04c70424"],
52
+
53
+ "patch_replace": {
54
+ "ì": "í",
55
+ "Ì": "Í",
56
+ "ò": "ó",
57
+ "Ò": "Ó"
58
+ },
59
+
60
+ "clean_pattern": "\\[.*?\\]|\\*",
61
+ "whitelist": ["latin", "spanish", "cyrillic"],
62
+
63
+ "source_language": "es",
64
+ "target_language": "it",
65
+ "among_languages": ["en", "ja", "ko", "de", "fr", "es", "pt", "ru", "zh"]
66
+ }
67
+ ```
@@ -3,10 +3,10 @@ from setuptools import setup
3
3
 
4
4
  setup(
5
5
  name = "strindex",
6
- version = "3.2.0",
6
+ version = "3.3.0",
7
7
  author = "zWolfrost",
8
8
  author_email = "zwolfrost@gmail.com",
9
- description = "A command line utility to view, edit and patch strings in PE files, with a focus on compatibility and translation.",
9
+ description = "A command line utility to extract and patch strings of various filetypes, with a focus on compatibility and translation.",
10
10
  long_description = open(os.path.join(os.path.dirname(__file__), 'README.md')).read(),
11
11
  long_description_content_type = 'text/markdown',
12
12
  license = "MIT",
@@ -0,0 +1,329 @@
1
+ import os, sys, argparse, re
2
+ from hashlib import md5
3
+ from importlib import import_module
4
+ from .utils import PrintProgress, Strindex, FileBytearray, truncate_prev_char
5
+
6
+
7
+ def get_module_methods(data: FileBytearray, action: str) -> dict:
8
+ """
9
+ Returns the methods of the module associated with the file type.
10
+ """
11
+
12
+ for file in os.listdir(os.path.join(os.path.dirname(__file__), "filetypes")):
13
+ if file.endswith(".py") and file != "__init__.py":
14
+ try:
15
+ module = import_module(".filetypes." + file.rstrip('.py'), __package__)
16
+ except ImportError:
17
+ continue
18
+
19
+ if module.is_valid(data):
20
+ print(f'Detected filetype: "{file.rstrip(".py")}"')
21
+ assert action in module.__dict__, f"Action '{action}' is not available for this file type."
22
+ return module.__dict__[action]
23
+
24
+ raise ValueError("This file type has no associated module, or the required libraries to handle it are not installed.")
25
+
26
+
27
+ def create(file_filepath: str, strindex_filepath: str, compatible: bool, min_length: int, prefixes: list[bytes]):
28
+ """
29
+ Calls the create method of the module associated with the file type.
30
+ """
31
+
32
+ data = FileBytearray(open(file_filepath, 'rb').read())
33
+
34
+ STRINDEX: Strindex = get_module_methods(data, "create")(data, min_length, prefixes)
35
+
36
+ STRINDEX.original = STRINDEX.overwrite
37
+ STRINDEX.replace = STRINDEX.overwrite
38
+ STRINDEX.pointers_switches = STRINDEX.pointers
39
+ STRINDEX.type_order = ["compatible" if compatible else "original"] * len(STRINDEX.overwrite)
40
+
41
+ STRINDEX.settings["md5"] = md5(data).hexdigest()
42
+ if prefixes != [b'']:
43
+ STRINDEX.settings["prefix_bytes"] = [prefix.hex() for prefix in prefixes]
44
+
45
+ STRINDEX.save(strindex_filepath)
46
+
47
+ print("Created strindex file.")
48
+
49
+ def patch(file_filepath: str, strindex_filepath: str, file_patched_filepath: str):
50
+ """
51
+ Calls the patch method of the module associated with the file type.
52
+ """
53
+
54
+ file_filepath_bak = file_filepath + '.bak'
55
+
56
+ data = FileBytearray(open(file_filepath_bak if os.path.exists(file_filepath_bak) else file_filepath, 'rb').read())
57
+
58
+ STRINDEX: Strindex = Strindex.from_file(strindex_filepath)
59
+
60
+ if STRINDEX.settings["md5"] and STRINDEX.settings["md5"] != md5(data).hexdigest():
61
+ print("MD5 hash does not match the one the strindex was created for. You might encounter issues.")
62
+
63
+ if not file_patched_filepath:
64
+ if not os.path.exists(file_filepath_bak):
65
+ os.rename(file_filepath, file_filepath_bak)
66
+ file_patched_filepath = file_filepath
67
+
68
+ data = get_module_methods(data, "patch")(data, STRINDEX)
69
+ open(file_patched_filepath, 'wb').write(data)
70
+
71
+ print("File was patched successfully.")
72
+
73
+ def filter(strindex_filepath: str, strindex_filter_filepath: str):
74
+ """
75
+ Filters a strindex file with another with respect to length, whitelist and source language.
76
+ """
77
+
78
+ STRINDEX = Strindex.from_file(strindex_filepath)
79
+ STRINDEX_LINES = STRINDEX.get_ordered_strings(lambda t: "original" if t == "compatible" else t)
80
+
81
+ if STRINDEX.settings["source_language"]:
82
+ try:
83
+ from lingua import IsoCode639_1, LanguageDetectorBuilder
84
+ except ImportError:
85
+ raise ImportError(
86
+ "Please install the 'lingua' package (pip install lingua) to filter by language."
87
+ )
88
+
89
+ ALL_LANGUAGES = [code for code in IsoCode639_1.__dict__.values() if isinstance(code, IsoCode639_1)]
90
+ SETTINGS_LANGUAGES = [getattr(IsoCode639_1, code.upper()) for code in STRINDEX.settings["among_languages"]]
91
+
92
+ detector = LanguageDetectorBuilder.from_iso_codes_639_1(*(SETTINGS_LANGUAGES or ALL_LANGUAGES)).build()
93
+
94
+ def is_source_language(string: str) -> bool:
95
+ line_clean = re.sub(STRINDEX.settings["clean_pattern"], "", string)
96
+ confidence = detector.compute_language_confidence_values(line_clean)[0]
97
+ return confidence.language.iso_code_639_1 == getattr(IsoCode639_1, STRINDEX.settings["source_language"].upper()) and confidence.value > 0.5
98
+
99
+ print_progress = PrintProgress(len(STRINDEX_LINES))
100
+ with open(strindex_filter_filepath, 'w', encoding='utf-8') as f:
101
+ f.write(STRINDEX.full_header)
102
+
103
+ for strindex_index, line in enumerate(STRINDEX_LINES):
104
+ if (
105
+ (not STRINDEX.settings["source_language"] or is_source_language(line)) and
106
+ (len(line) >= STRINDEX.settings["min_length"]) and
107
+ (not STRINDEX.settings.get("whitelist") or not any(ch not in STRINDEX.settings["whitelist"] for ch in line))
108
+ ):
109
+ f.write(STRINDEX.create_raw_from_index(strindex_index))
110
+
111
+ print_progress(strindex_index)
112
+
113
+ truncate_prev_char(f)
114
+ print("Created filtered strindex file.")
115
+
116
+ def delta(strindex_full_filepath: str, strindex_diff_filepath: str, strindex_delta_filepath: str, reverse: bool = False):
117
+ """
118
+ Filters a full strindex file with a delta strindex file, or intersects them.
119
+ """
120
+
121
+ STRINDEX_1 = Strindex.from_file(strindex_full_filepath)
122
+ STRINDEX_2 = Strindex.from_file(strindex_diff_filepath)
123
+
124
+ STRINDEX_1_LINES = STRINDEX_1.get_ordered_strings(lambda t: "original" if t == "compatible" else t)
125
+ STRINDEX_2_LINES = STRINDEX_2.get_ordered_strings(lambda t: "original" if t == "compatible" else t)
126
+
127
+ with open(strindex_delta_filepath, 'w', encoding='utf-8') as f:
128
+ f.write(STRINDEX_1.full_header)
129
+
130
+ index_2 = 0
131
+ for full_index in range(len(STRINDEX_1.type_order)):
132
+ try:
133
+ index_2 = STRINDEX_2_LINES.index(STRINDEX_1_LINES[full_index], index_2)
134
+ except ValueError:
135
+ if not reverse:
136
+ f.write(STRINDEX_1.create_raw_from_index(full_index))
137
+ else:
138
+ if reverse:
139
+ f.write(STRINDEX_1.create_raw_from_index(full_index))
140
+
141
+ truncate_prev_char(f)
142
+
143
+ print("Created delta strindex file.")
144
+
145
+ def spellcheck(strindex_filepath: str, strindex_spellcheck_filepath: str):
146
+ """
147
+ Creates a spellcheck file from a strindex file, for the specified language.
148
+ """
149
+
150
+ try:
151
+ from language_tool_python import LanguageTool
152
+ except ImportError:
153
+ raise ImportError("Please install the 'language-tool-python' package (pip install language-tool-python) to use this feature.")
154
+
155
+ STRINDEX = Strindex.from_file(strindex_filepath)
156
+ STRINDEX_LINES = STRINDEX.get_ordered_strings(lambda t: "replace" if t == "compatible" else t)
157
+
158
+ if not STRINDEX.settings["target_language"]:
159
+ raise ValueError("Please specify the target language to spellcheck in the strindex file ('target_language').")
160
+
161
+ lang = LanguageTool(STRINDEX.settings["target_language"])
162
+ print("Created language tool.")
163
+
164
+ with open(strindex_spellcheck_filepath, 'w', encoding='utf-8') as f:
165
+ print_progress = PrintProgress(len(STRINDEX_LINES))
166
+ for strindex_index, line in enumerate(STRINDEX_LINES):
167
+ line_clean = re.sub(STRINDEX.settings["clean_pattern"], "", line)
168
+ for error in lang.check(line_clean):
169
+ f.write('\n'.join(str(error).split('\n')[-3:]) + '\n')
170
+
171
+ print_progress(strindex_index)
172
+ print("Spellchecked strindex file.")
173
+
174
+
175
+ def patch_gui():
176
+ try:
177
+ from PySide6 import QtCore, QtWidgets, QtGui
178
+ except ImportError:
179
+ raise ImportError("Please install the 'PySide6' package (pip install pyside6) to use this feature.")
180
+
181
+ class PatchGUI(QtWidgets.QWidget):
182
+ def __init__(self):
183
+ super().__init__()
184
+
185
+ # file selection
186
+ self.file_line = QtWidgets.QLineEdit()
187
+ self.file_line.setPlaceholderText("Select a file to patch")
188
+ self.file_line.textChanged.connect(self.update)
189
+ self.file_line.textChanged.connect(lambda: self.file_line.setStyleSheet(self.file_line.styleSheet()))
190
+ self.file_line.setFont(QtGui.QFont("monospace"))
191
+ self.file_button = QtWidgets.QPushButton("Browse Files")
192
+ self.file_button.clicked.connect(lambda: self.browse(self.file_line, "Open File", "All Files (*)"))
193
+
194
+ # strindex selection
195
+ self.strindex_line = QtWidgets.QLineEdit()
196
+ self.strindex_line.setPlaceholderText("Select a Strindex file")
197
+ self.strindex_line.textChanged.connect(self.update)
198
+ self.strindex_line.textChanged.connect(lambda: self.strindex_line.setStyleSheet(self.strindex_line.styleSheet()))
199
+ self.strindex_line.setFont(QtGui.QFont("monospace"))
200
+ self.strindex_button = QtWidgets.QPushButton("Browse Strindex")
201
+ self.strindex_button.clicked.connect(lambda: self.browse(self.strindex_line, "Open Strindex", "Text Files (*.txt)"))
202
+
203
+ # patch button
204
+ self.patch_button = QtWidgets.QPushButton("Patch")
205
+ self.patch_button.clicked.connect(self.patch)
206
+ self.patch_button.setEnabled(False)
207
+
208
+ # progress bar
209
+ self.progress_bar = QtWidgets.QProgressBar()
210
+ self.progress_bar.setRange(0, 100)
211
+ self.progress_bar.setFormat("Patching... %p%")
212
+ self.progress_bar.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
213
+ PrintProgress.callback = lambda progress: self.progress_bar.setValue(progress.percent)
214
+
215
+ # add widgets to layout
216
+ self.grid_layout = QtWidgets.QGridLayout()
217
+ self.grid_layout.addWidget(self.file_line, 0, 0)
218
+ self.grid_layout.addWidget(self.file_button, 0, 1)
219
+ self.grid_layout.addWidget(self.strindex_line, 1, 0)
220
+ self.grid_layout.addWidget(self.strindex_button, 1, 1)
221
+ self.grid_layout.addWidget(self.patch_button, 2, 0, 1, 2)
222
+ self.grid_layout.setSpacing(10)
223
+ self.grid_layout.setColumnStretch(0, 1)
224
+ self.grid_layout.setColumnMinimumWidth(0, 200)
225
+ self.setLayout(self.grid_layout)
226
+
227
+ # set window properties
228
+ WINDOWS_STYLESHEET = f""""""
229
+ UNIX_STYLESHEET = f"""QLineEdit[text=""]{{color: {self.palette().windowText().color().name()};}}"""
230
+ self.setWindowTitle("Strindex Patch")
231
+ self.setStyleSheet(WINDOWS_STYLESHEET if sys.platform == "win32" else UNIX_STYLESHEET)
232
+ self.setWindowFlag(QtCore.Qt.WindowType.WindowMaximizeButtonHint, False)
233
+ self.setMaximumSize(1600, 0)
234
+ self.resize(800, 0)
235
+ self.center()
236
+
237
+ def browse(self, line: QtWidgets.QLineEdit, caption, filter):
238
+ if filepath := QtWidgets.QFileDialog.getOpenFileName(self, caption, "", filter)[0]:
239
+ line.setText(filepath)
240
+
241
+ def update(self):
242
+ path_exists = os.path.isfile(self.file_line.text()) and os.path.isfile(self.strindex_line.text())
243
+ self.patch_button.setEnabled(path_exists)
244
+
245
+ def patch(self):
246
+ self.setEnabled(False)
247
+ self.progress_bar.setValue(0)
248
+ self.grid_layout.replaceWidget(self.patch_button, self.progress_bar)
249
+ self.patch_button.setParent(None)
250
+ QtWidgets.QApplication.processEvents()
251
+
252
+ try:
253
+ patch(self.file_line.text(), self.strindex_line.text(), None)
254
+ self.progress_bar.setValue(100)
255
+ except BaseException as e:
256
+ self.message(str(e), QtWidgets.QMessageBox.Critical)
257
+ else:
258
+ self.message("File patched successfully.", QtWidgets.QMessageBox.Information)
259
+ finally:
260
+ self.grid_layout.replaceWidget(self.progress_bar, self.patch_button)
261
+ self.progress_bar.setParent(None)
262
+ self.setEnabled(True)
263
+ QtWidgets.QApplication.processEvents()
264
+
265
+ def center(self):
266
+ res = QtGui.QGuiApplication.primaryScreen().availableGeometry()
267
+ self.move((res.width() - self.width()) // 2, (res.height() - self.height()) // 2)
268
+
269
+ def message(self, text: str, icon):
270
+ msg = QtWidgets.QMessageBox()
271
+ msg.setWindowTitle(self.windowTitle())
272
+ msg.setIcon(icon)
273
+ msg.setText(text)
274
+ msg.setStandardButtons(QtWidgets.QMessageBox.Ok.Ok)
275
+ msg.exec()
276
+ return msg
277
+
278
+ app = QtWidgets.QApplication([])
279
+ gui = PatchGUI()
280
+ gui.show()
281
+ sys.exit(app.exec())
282
+
283
+
284
+ def main():
285
+ if "__compiled__" in globals():
286
+ patch_gui()
287
+ else:
288
+ try:
289
+ parser = argparse.ArgumentParser(prog="strindex", description="Command line string replacement tool for games.")
290
+
291
+ parser.add_argument("action", type=str, choices=["create", "patch", "patch_gui", "filter", "delta", "spellcheck"], help="Action to perform.")
292
+ parser.add_argument("files", type=str, nargs=argparse.ZERO_OR_MORE, help="One or more files to process.")
293
+ parser.add_argument("-o", "--output", type=str, help="Output file.")
294
+
295
+ # create arguments
296
+ parser.add_argument("-c", "--compatible", action="store_true", help="Whether to create a strindex file compatible with the previous versions of a program.")
297
+ parser.add_argument("-m", "--min-length", type=int, default=3, help="Minimum length of the strings to be included.")
298
+ parser.add_argument("-p", "--prefix-bytes", type=str, action="append", default=[], help="Prefix bytes to add to the rva in the strindex file.")
299
+
300
+ # delta arguments
301
+ parser.add_argument("-r", "--reverse-delta", action="store_true", help="Whether to reverse the delta operation and intersect the files.")
302
+
303
+ args = parser.parse_args()
304
+
305
+ if not all([os.path.isfile(file) for file in args.files]):
306
+ raise FileNotFoundError("One or more files do not exist.")
307
+
308
+ args.prefix_bytes = [bytes.fromhex(prefix) for prefix in (args.prefix_bytes or [''])]
309
+
310
+ match args.action:
311
+ case "create":
312
+ create(*args.files, (args.output or "strindex.txt"), args.compatible, args.min_length, args.prefix_bytes)
313
+ case "patch":
314
+ patch(*args.files, args.output)
315
+ case "patch_gui":
316
+ patch_gui()
317
+ case "filter":
318
+ filter(*args.files, (args.output or "strindex_filter.txt"))
319
+ case "delta":
320
+ delta(*args.files, (args.output or "strindex_delta.txt"), args.reverse_delta)
321
+ case "spellcheck":
322
+ spellcheck(*args.files, (args.output or "strindex_spellcheck.txt"))
323
+ except KeyboardInterrupt:
324
+ print("Interrupted by user.")
325
+ except BaseException as e:
326
+ print(e)
327
+
328
+ if __name__ == "__main__":
329
+ main()