diff --git a/CHANGELOG.md b/CHANGELOG.md index 24139df6..72c626b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,9 +60,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 Also a mechanism to define variables in KiCad 6. (#161) - Annotate power components. (#76) - Annotate according to PCB coordinates (#93) -- Now you can compress files relative to the current working directory. - So you can create a compressed file containing the source schematic and - PCB files. (#93) +- Compress: + - Now you can compress files relative to the current working directory. + So you can create a compressed file containing the source schematic and + PCB files. (#93) + - Added an option to remove the files we compressed. (#192) - Support for new KiCost options `split_extra_fields` and `board_qty`. (#120) - Datasheet downloader. (#119) - Position files now can include virtual components. (#106) diff --git a/README.md b/README.md index 63962437..8cc5d113 100644 --- a/README.md +++ b/README.md @@ -1174,7 +1174,9 @@ Next time you need this list just use an alias, like this: By default this pattern is applied to the output dir specified with `-d` command line option. See the `from_cwd` option. - `format`: [string='ZIP'] [ZIP,TAR,RAR] Output file format. + - `move_files`: [boolean=false] Move the files to the archive. In other words: remove the files after adding them to the archive. - `output`: [string='%f-%i%I%v.%x'] Name for the generated archive (%i=name of the output %x=according to format). Affected by global options. + - *remove_files*: Alias for move_files. - `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output. - `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested. diff --git a/docs/samples/generic_plot.kibot.yaml b/docs/samples/generic_plot.kibot.yaml index e9e53b1c..2f8ea3af 100644 --- a/docs/samples/generic_plot.kibot.yaml +++ b/docs/samples/generic_plot.kibot.yaml @@ -390,8 +390,11 @@ outputs: source: '*' # [string='ZIP'] [ZIP,TAR,RAR] Output file format format: 'ZIP' + # [boolean=false] Move the files to the archive. In other words: remove the files after adding them to the archive + move_files: false # [string='%f-%i%I%v.%x'] Name for the generated archive (%i=name of the output %x=according to format). Affected by global options output: '%f-%i%I%v.%x' + # `remove_files` is an alias for `move_files` # Datasheets downloader: - name: 'download_datasheets_example' comment: 'Downloads the datasheets for the project' diff --git a/kibot/out_compress.py b/kibot/out_compress.py index 3174a8e0..42d20450 100644 --- a/kibot/out_compress.py +++ b/kibot/out_compress.py @@ -64,6 +64,10 @@ class CompressOptions(BaseOptions): """ [auto,stored,deflated,bzip2,lzma] Compression algorithm. Use auto to let KiBot select a suitable one """ self.files = FilesList """ [list(dict)] Which files will be included """ + self.move_files = False + """ Move the files to the archive. In other words: remove the files after adding them to the archive """ + self.remove_files = None + """ {move_files} """ super().__init__() def config(self, parent): @@ -186,6 +190,10 @@ class CompressOptions(BaseOptions): self.create_tar(output, files) elif self.format == 'RAR': self.create_rar(output, files) + if self.move_files: + for fname in files.keys(): + logger.debug('Removing '+fname) + os.remove(fname) @output_class