.bom

.bom addcategory "category"
.bom setcolumn "category" "section" "column" [...]
.bom data category" "section" "column=value" [...]
The .bom command adds data to the Bill of Materials (BOM) for a build. With it, you can add categories, sections, and data.
Categories
A category is a header printed in the BOM. Use the addcategory option to specify them.
.bom addcategory "category"
Sections
A section defines columns of data within a category. Use the setcolumn option to specify sections and columns within the sections. Section names are not printed. The set of column headers for the section is printed at the beginning of a section. You can nest sections by using the -p option and identifying the parent section.

Sections and columns must be defined before data options attempt to add data to them.

.bom setcolumn "category" "section" "columnheader" [...]
.bom setcolumn "category" "section" -p parentsection"columnheader" [...]
Data
Data populates the columns defined in a section. The section and columns must already be defined using setcolumn.
.bom data category" "section" "column=value" [...]

The following example shows the order in which categories, sections and columns, and data must be specified.


.bom addcategory "Spaceships"
.bom setcolumn "Spaceships" "Section1" "ShipName" "WarpSpeed" "Tonnage"
.bom setcolumn "Spaceships" "Subsection1" -p "Section1" "ShippingDate" "ShippingManifest"
.bom data "Spaceships" "Section1" "ShipName=SpaceShipOne" "WarpSpeed=9" "Tonnage=10000"
.bom data "Spaceships" "Subsection1" "ShippingDate=123" "ShippingManifest=456"
.bom data "Spaceships" "Section1" "ShipName=Freighter" "WarpSpeed=6" "Tonnage=20000" 

This example shows in the BOM as follows:

ShipName      WarpSpeed   Tonnage
SpaceShipOne      9        10000
                                   ShippingDate       ShippingManifest
                                       123                  456
Freighter         6        20000
As with other dot commands, you can use environment variables in the command. A command like
.bom data "Spaceships" "${SECTION}" "ShipName=${NAME}" "WarpSpeed=${SPEED}" "Tonnage=${TONNAGE}"

populates the BOM with data loaded into environment variables by earlier commands.

You can create any number of columns, but the system does not write a line to the BOM until the last column is populated.

If you omit a column from a data line, the system uses the value from the previous row, as the following example shows.
.bom addcategory "Spaceships"
.bom setcolumn "Spaceships" "Section1" "ShipName" "WarpSpeed" "Tonnage"
.bom data "Spaceships" "Section1" "ShipName=SpaceShipTwo" "WarpSpeed=3" "Tonnage=30000"
.bom data "Spaceships" "Section1" "ShipName=Tanker" "Tonnage=50000"

The result is that the WarpSpeed value from SpaceShipOne is repeated:
ShipName      WarpSpeed   Tonnage
SpaceShipTwo      3        30000
Tanker            3        50000

Feedback