diff --git a/CHANGELOG.md b/CHANGELOG.md index 650a394a..2e3f48ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - BoM: Digi-key link in the HTML output. - Problems when using more than one dielectric in the stack-up. (#328) - Gerber: Extension used for JLCPCB inner layers. (#329) +- BoM: The length of the CSV separator is now validated. ## [1.4.0] - 2022-10-12 ### Added diff --git a/README.md b/README.md index 02a7f6a3..c6b40ccc 100644 --- a/README.md +++ b/README.md @@ -1435,6 +1435,7 @@ Notes: * Valid keys: - **`quote_all`**: [boolean=false] Enclose all values using double quotes. - **`separator`**: [string=','] CSV Separator. TXT and TSV always use tab as delimiter. + Only one character can be specified. - `hide_header`: [boolean=false] Hide the header line (names of the columns). - `hide_pcb_info`: [boolean=false] Hide project information. - `hide_stats_info`: [boolean=false] Hide statistics information. diff --git a/docs/samples/generic_plot.kibot.yaml b/docs/samples/generic_plot.kibot.yaml index aaf23427..d6b30bcd 100644 --- a/docs/samples/generic_plot.kibot.yaml +++ b/docs/samples/generic_plot.kibot.yaml @@ -210,7 +210,8 @@ outputs: hide_stats_info: false # [boolean=false] Enclose all values using double quotes quote_all: false - # [string=','] CSV Separator. TXT and TSV always use tab as delimiter + # [string=','] CSV Separator. TXT and TSV always use tab as delimiter. + # Only one character can be specified separator: ',' # [string|list(string)] Include this distributors list. Default is all the available distributors: diff --git a/kibot/out_bom.py b/kibot/out_bom.py index 2204061a..7a8c78bf 100644 --- a/kibot/out_bom.py +++ b/kibot/out_bom.py @@ -247,7 +247,8 @@ class BoMCSV(Optionable): super().__init__() with document: self.separator = ',' - """ *CSV Separator. TXT and TSV always use tab as delimiter """ + """ *CSV Separator. TXT and TSV always use tab as delimiter. + Only one character can be specified """ self.hide_header = False """ Hide the header line (names of the columns) """ self.hide_pcb_info = False @@ -257,6 +258,11 @@ class BoMCSV(Optionable): self.quote_all = False """ *Enclose all values using double quotes """ + def config(self, parent): + super().config(parent) + if len(self.separator) != 1: + raise KiPlotConfigurationError('The CSV separator must be one character (`{}`)'.format(self.separator)) + class BoMXLSX(BoMLinkable): """ XLSX options """