serge icon indicating copy to clipboard operation
serge copied to clipboard

Improve `clean-ts` file handling

Open iafan opened this issue 4 years ago • 0 comments

Right now, clean-ts command scans only .po files, which doesn't work well with other interchange file formats that are now supported (e.g. XLIFF) or any custom file naming conventions or future formats.

To make sure clean-ts logic is future-proof, we need to implement the following:

  1. By default, assume that each directory with translation interchange files contains only files in one format; scan for all files in that folder, analyze their extensions and if extension is the same, delete all files with that extension. If there are multiple extensions, bail out (to prevent destructive command behavior if it accidentally configured to run against some random folder with important data).
  2. Implement the --extenstions=xx,yy,zz (shorthand: --ext=xx,yy,zz) flag that will allow one to explicitly specify extensions of files to clean up.
  3. Ignore (do not delete, and skip while traversing) directories and files that start with a dot (e.g. .cache or .gitignore). This will allow external synchronization plugins to store their synchronization cache/state right next to the synced data. It should be a responsibility of an individual TS sync plugin to clean up their cache if, for example, they see that there are no files to synchronize.

iafan avatar Aug 08 '19 16:08 iafan