|
16 | 16 | fromcollectionsimportCounter |
17 | 17 | importos |
18 | 18 | fromdataclassesimportdataclass |
| 19 | +frompathlibimportPath |
19 | 20 | fromreimportmatch,search |
20 | 21 | fromsubprocessimportcall,run |
21 | 22 | importsys |
22 | 23 | fromurllib.parseimportunquote |
| 24 | +fromwarningsimportwarn |
23 | 25 |
|
24 | 26 | LANGUAGE='pl' |
25 | 27 |
|
@@ -91,6 +93,20 @@ def recreate_tx_config(): |
91 | 93 | 'source_lang = en\n', |
92 | 94 | ) |
93 | 95 | ) |
| 96 | +warn_about_files_to_delete() |
| 97 | + |
| 98 | +defwarn_about_files_to_delete(): |
| 99 | +files=list(_get_files_to_delete()) |
| 100 | +ifnotfiles: |
| 101 | +return |
| 102 | +warn(f'Found{len(files)} file(s) to delete:{", ".join(files)}.') |
| 103 | + |
| 104 | +def_get_files_to_delete(): |
| 105 | +withopen('.tx/config')asconfig_file: |
| 106 | +config=config_file.read() |
| 107 | +forfileinPath().rglob('*.po'): |
| 108 | +ifos.fsdecode(file)notinconfig: |
| 109 | +yieldos.fsdecode(file) |
94 | 110 |
|
95 | 111 |
|
96 | 112 | @dataclass |
@@ -259,7 +275,7 @@ def average(averages, weights): |
259 | 275 |
|
260 | 276 |
|
261 | 277 | if__name__=="__main__": |
262 | | -RUNNABLE_SCRIPTS= ('fetch','recreate_tx_config','recreate_readme') |
| 278 | +RUNNABLE_SCRIPTS= ('fetch','recreate_tx_config','recreate_readme','warn_about_files_to_delete') |
263 | 279 |
|
264 | 280 | parser=ArgumentParser() |
265 | 281 | parser.add_argument('cmd',nargs=1,choices=RUNNABLE_SCRIPTS) |
|