To actually see the buffer, use the
--print
option. It takes a single
argument, called a report.
Here is an example for starters:
Example 2.1. Introducing the --print option
$
pantry --name Bananas --print names master
Cereals ready-to-eat, KELLOGG'S, CORN FLAKES With Real Bananas Bananas, dehydrated, or banana powder Bananas, raw
As you can see, --print names
simply
prints the name of each food in the buffer. Here the
name of the report is names
.
Other handy reports are traits
,
units
, and
nuts
, to print the traits,
available units, and nutrient breakdown of each food in
the buffer.
The traits
report always shows
the qty
and unit
traits. Other traits are shown only if they are equal to
a non-zero-length string or, in the case of the
pctRefuse
trait, if it is not equal
to zero.
Example 2.2. Using --print traits
$
pantry --name Bananas --print traits master
Cereals ready-to-eat, KELLOGG'S, CORN FLAKES With Real Bananas Group: Breakfast Cereals 100 g (100g) Bananas, dehydrated, or banana powder Group: Fruits and Fruit Juices 100 g (100g) Bananas, raw Group: Fruits and Fruit Juices Refuse: 36 percent Skin 100 g (100g)
The units
report prints each
food's available units. It does not print
g
, oz
,
or lb
as these are available
for every food.
Example 2.3. Using --print units
$
pantry --name "Bananas, raw" --print units master
cup, mashed large (8" to 8-7/8" long) medium (7" to 7-7/8" long) extra small (less than 6" long) small (6" to 6-7/8" long) NLEA serving cup, sliced extra large (9" or longer)
The nuts
report prints a food's
nutrient breakdown. Later we will talk about why
pantry printed these particular
nutrients, as there are many more nutrients for
Bananas, raw
than were printed
here. Also, later we will learn what the two rightmost
columns in the report mean (you probably can tell what
the first two columns are for.)
Example 2.4. Using --print nuts
$
pantry --name "Bananas, raw" --print nuts master
Nutrient Amount %G %TOT ------------------------------------------------------- Calories 89 kcal 4 100 Total Fat 0 g 1 100 Saturated Fat 0 g 1 100 Cholesterol 0 mg 0 0 Sodium 1 mg 0 100 Total Carbohydrate 23 g 8 100 Dietary Fiber 3 g 10 100 Sugars 12 g NA 100 Protein 1 g 2 100 Vitamin A 64 IU 1 100 Vitamin C 9 mg 14 100 Calcium 5 mg 0 100 Iron 0 mg 1 100
The nuts
and
units
reports print only a
food's nutrients and available units,
respectively. They do not print anything else about
the food, not even its name
trait. When there is more than one food in the
buffer, one report is printed for each food.
It may be obvious that you are
looking at the results for more than one food when
you are examining a set of
nuts
reports.
Example 2.5. Two nuts
reports
$
pantry --name Papaya --print names master
Papayas, raw Papaya nectar, canned
$
pantry --name Papaya --print nuts master
Nutrient Amount %G %TOT ------------------------------------------------------- Calories 39 kcal 2 41 Total Fat 0 g 0 48 Saturated Fat 0 g 0 48 Cholesterol 0 mg 0 0 Sodium 3 mg 0 38 Total Carbohydrate 10 g 3 40 Dietary Fiber 2 g 7 75 Sugars 6 g NA 30 Protein 1 g 1 78 Vitamin A 1094 IU 22 75 Vitamin C 62 mg 103 95 Calcium 24 mg 2 71 Iron 0 mg 1 23 Nutrient Amount %G %TOT ------------------------------------------------------- Calories 57 kcal 3 59 Total Fat 0 g 0 52 Saturated Fat 0 g 0 52 Cholesterol 0 mg 0 0 Sodium 5 mg 0 62 Total Carbohydrate 15 g 5 60 Dietary Fiber 1 g 2 25 Sugars 14 g NA 70 Protein 0 g 0 22 Vitamin A 361 IU 7 25 Vitamin C 3 mg 5 5 Calcium 10 mg 1 29 Iron 0 mg 2 77
However, in the next example, you cannot even tell that
you are looking at two units
reports here, and you certainly cannot tell the two
foods apart. This next example shows units reports for
both Papaya nectar, canned
and
Papayas, raw
:
Example 2.6. Two units
reports
$
pantry --name Papaya --print units master
small (4-1/2" long x 2-3/4" dia) medium (5-1/8" long x 3" dia) cup, mashed cup, cubes large (5-3/4" long x 3-1/4" dia) fl oz cup
We will discover a solution to this problem in the
next section.
As you saw above, using just the
nuts
or
units
reports can be
confusing, especially when you have more than
one food in your buffer, because these
reports do not indicate which food goes with
which nutrients or with which units.
An easy solution for this is to combine reports. By separating each report name with a dash, you may tell pantry to print more than one report for each food.
Example 2.7. Combining reports
$
pantry --name Papaya --print names-units master
Papayas, raw small (4-1/2" long x 2-3/4" dia) medium (5-1/8" long x 3" dia) cup, mashed cup, cubes large (5-3/4" long x 3-1/4" dia) Papaya nectar, canned fl oz cup
$
pantry --name Papaya --print traits-nuts master
Papayas, raw Group: Fruits and Fruit Juices Refuse: 33 percent Seeds and skin 100 g (100g) Nutrient Amount %G %TOT ------------------------------------------------------- Calories 39 kcal 2 41 Total Fat 0 g 0 48 Saturated Fat 0 g 0 48 Cholesterol 0 mg 0 0 Sodium 3 mg 0 38 Total Carbohydrate 10 g 3 40 Dietary Fiber 2 g 7 75 Sugars 6 g NA 30 Protein 1 g 1 78 Vitamin A 1094 IU 22 75 Vitamin C 62 mg 103 95 Calcium 24 mg 2 71 Iron 0 mg 1 23 Papaya nectar, canned Group: Fruits and Fruit Juices 100 g (100g) Nutrient Amount %G %TOT ------------------------------------------------------- Calories 57 kcal 3 59 Total Fat 0 g 0 52 Saturated Fat 0 g 0 52 Cholesterol 0 mg 0 0 Sodium 5 mg 0 62 Total Carbohydrate 15 g 5 60 Dietary Fiber 1 g 2 25 Sugars 14 g NA 70 Protein 0 g 0 22 Vitamin A 361 IU 7 25 Vitamin C 3 mg 5 5 Calcium 10 mg 1 29 Iron 0 mg 2 77
As you can see, some whitespace would help make
this more readable. To add whitespace, use the
blank
report. It simply
prints a blank line.
Example 2.8. Using the blank
report
$
pantry --name Papaya --print traits-nuts-blank master
Papayas, raw Group: Fruits and Fruit Juices Refuse: 33 percent Seeds and skin 100 g (100g) Nutrient Amount %G %TOT ------------------------------------------------------- Calories 39 kcal 2 41 Total Fat 0 g 0 48 Saturated Fat 0 g 0 48 Cholesterol 0 mg 0 0 Sodium 3 mg 0 38 Total Carbohydrate 10 g 3 40 Dietary Fiber 2 g 7 75 Sugars 6 g NA 30 Protein 1 g 1 78 Vitamin A 1094 IU 22 75 Vitamin C 62 mg 103 95 Calcium 24 mg 2 71 Iron 0 mg 1 23 Papaya nectar, canned Group: Fruits and Fruit Juices 100 g (100g) Nutrient Amount %G %TOT ------------------------------------------------------- Calories 57 kcal 3 59 Total Fat 0 g 0 52 Saturated Fat 0 g 0 52 Cholesterol 0 mg 0 0 Sodium 5 mg 0 62 Total Carbohydrate 15 g 5 60 Dietary Fiber 1 g 2 25 Sugars 14 g NA 70 Protein 0 g 0 22 Vitamin A 361 IU 7 25 Vitamin C 3 mg 5 5 Calcium 10 mg 1 29 Iron 0 mg 2 77