Rename column_name
to name
See https://github.com/AllSpiceIO/generate-bom/pull/8#discussion_r1611771720
This commit is contained in:
parent
28ac5f7aae
commit
8c5d681f86
18
README.md
18
README.md
@ -44,25 +44,25 @@ The format of this YAML file is as follows:
|
||||
|
||||
```yml
|
||||
columns:
|
||||
- column_name: Manufacturer
|
||||
- name: Manufacturer
|
||||
part_attributes:
|
||||
- Manufacturer
|
||||
- MANUFACTURER
|
||||
- column_name: Part Number
|
||||
- name: Part Number
|
||||
part_attributes:
|
||||
- PART
|
||||
- MANUFACTURER \#
|
||||
- _part_id
|
||||
- column_name: Designator
|
||||
- name: Designator
|
||||
part_attributes: Designator
|
||||
- column_name: Description
|
||||
- name: Description
|
||||
part_attributes:
|
||||
- PART DESCRIPTION
|
||||
- _description
|
||||
```
|
||||
|
||||
First, you have the key `columns:` which is mapped to a list. Each element of
|
||||
the list has two key/value pairs. The first is `column_name`, which is used to
|
||||
the list has two key/value pairs. The first is `name`, which is used to
|
||||
as the name of the column. Next, you have `part_attributes`. This can either be
|
||||
just a string (like in the case of the `Designator` column) or a list of strings
|
||||
(like in the other cases.)
|
||||
@ -79,15 +79,15 @@ An example for OrCad `columns.yml` file content is:
|
||||
|
||||
```yml
|
||||
columns:
|
||||
- column_name: Part Number
|
||||
- name: Part Number
|
||||
part_attributes:
|
||||
- Part Number
|
||||
- _name
|
||||
- column_name: Designator
|
||||
- name: Designator
|
||||
part_attributes: Part Reference
|
||||
- column_name: Type
|
||||
- name: Type
|
||||
part_attributes: Part Type
|
||||
- column_name: Value
|
||||
- name: Value
|
||||
part_attributes: Value
|
||||
```
|
||||
|
||||
|
@ -76,7 +76,7 @@ if __name__ == "__main__":
|
||||
with open(columns_file, "r") as f:
|
||||
columns_data = yaml.safe_load(f.read())
|
||||
for column_value in columns_data["columns"]:
|
||||
columns[column_value["column_name"]] = column_value["part_attributes"]
|
||||
columns[column_value["name"]] = column_value["part_attributes"]
|
||||
except KeyError as e:
|
||||
print(f"Error: columns file {columns_file} does not seem to be in the right format.")
|
||||
print("Please refer to the README for more information.")
|
||||
|
Loading…
Reference in New Issue
Block a user