Skip to content

Commit 286604c

Browse files
committed
Uniformly use the -q flag for examples
Signed-off-by: Matt Rutkowski <[email protected]>
1 parent ea32ded commit 286604c

File tree

1 file changed

+32
-34
lines changed

1 file changed

+32
-34
lines changed

README.md

+32-34
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ All commands support the `--quiet` flag. By default, the utility outputs informa
296296
This example shows the `--quiet` flag being used on the `schema` command to turn off or "quiet" any informational output so that only the result table is displayed.
297297

298298
```bash
299-
./sbom-utility schema --quiet
299+
./sbom-utility schema list --quiet
300300
```
301301

302302
```bash
@@ -310,8 +310,6 @@ SPDX v2.3.1 (development) SPDX SPDX-2.3 development schema/spdx/2.3.
310310
...
311311
```
312312

313-
- **Note**: *The short-form `-q` (quiet) flag is equivalent to `--quiet`.*
314-
315313
#### Where flag (output filtering)
316314

317315
All `list` subcommands support the `--where` flag. It can be used to filter output results based upon matches to regular expressions (regex) by using the output list's column titles as keys.
@@ -421,7 +419,7 @@ Use the `--summary` flag on the `license list` command to produce a summary repo
421419
This example shows a few entries of the JSON output that exhibit the three types of license data described above:
422420

423421
```bash
424-
./sbom-utility license list -i examples/cyclonedx/SBOM/juice-shop-11.1.2/bom.json --format json --quiet
422+
./sbom-utility license list -i examples/cyclonedx/SBOM/juice-shop-11.1.2/bom.json --format json -q
425423
```
426424

427425
```json
@@ -465,7 +463,7 @@ This example shows a few entries of the JSON output that exhibit the three types
465463
This example shows the default text output from using the summary flag:
466464

467465
```bash
468-
./sbom-utility license list -i test/cyclonedx/cdx-1-3-license-list.json --summary --quiet
466+
./sbom-utility license list -i test/cyclonedx/cdx-1-3-license-list.json --summary -q
469467
```
470468

471469
```bash
@@ -503,7 +501,7 @@ The list command results can be filtered using the `--where` flag using the colu
503501
The following example shows filtering of component licenses using the `license-type` column where the license was described as a `name` value:
504502

505503
```bash
506-
./sbom-utility license list -i test/cyclonedx/cdx-1-3-license-list.json --summary --where license-type=name --quiet
504+
./sbom-utility license list -i test/cyclonedx/cdx-1-3-license-list.json --summary --where license-type=name -q
507505
```
508506

509507
```bash
@@ -520,7 +518,7 @@ needs-review name UFL ACME Application pkg:app/[email protected]
520518
In another example, the list is filtered by the `usage-policy` where the value is `needs-review`:
521519

522520
```bash
523-
./sbom-utility license list -i test/cyclonedx/cdx-1-3-license-list.json --summary --where usage-policy=needs-review --quiet
521+
./sbom-utility license list -i test/cyclonedx/cdx-1-3-license-list.json --summary --where usage-policy=needs-review -q
524522
```
525523

526524
```bash
@@ -565,7 +563,7 @@ Use the `--wrap` flag to toggle the wrapping of text within columns of the licen
565563
##### Example: license policy
566564

567565
```bash
568-
./sbom-utility license policy --quiet
566+
./sbom-utility license policy -q
569567
```
570568

571569
```bash
@@ -586,7 +584,7 @@ allow Artistic Artistic-1.0 Artistic License 1.0 true
586584
We can also apply the `--summary` flag to get a reduced set of columns that includes only the `usage-policy` along with the essential SPDX license information (e.g., no annotations or notes).
587585

588586
```bash
589-
./sbom-utility license policy --summary --quiet
587+
./sbom-utility license policy --summary -q
590588
```
591589

592590
```bash
@@ -622,7 +620,7 @@ allow Apache Apache-2.0 Apache License 2.0 true true false
622620
###### Example: policy with `--wrap` flag
623621

624622
```bash
625-
./sbom-utility license policy --quiet --wrap=true
623+
./sbom-utility license policy --wrap=true -q
626624
```
627625

628626
```bash
@@ -716,7 +714,7 @@ IETF RFC6902 JSON Patch file: [test/patch/cdx-patch-example-add-serial-number.js
716714
Invoke the patch command as follows:
717715

718716
```bash
719-
./sbom-utility patch --input-file test/patch/cdx-1-5-simplest-base.json --patch-file test/patch/cdx-patch-example-add-serial-number.json -q
717+
./sbom-utility patch --input-file test/patch/cdx-1-5-simplest-base.json --patch-file test/patch/cdx-patch-example-add-serial-number.json -q
720718
```
721719

722720
Patched JSON BOM output file:
@@ -761,7 +759,7 @@ IETF RFC6902 JSON Patch file: [test/patch/cdx-patch-example-add-serial-number.js
761759
Invoke the patch command as follows:
762760

763761
```bash
764-
./sbom-utility patch --input-file test/patch/cdx-1-5-simplest-base.json --patch-file test/patch/cdx-patch-example-add-update-version.json -q
762+
./sbom-utility patch --input-file test/patch/cdx-1-5-simplest-base.json --patch-file test/patch/cdx-patch-example-add-update-version.json -q
765763
```
766764

767765
The patched, output JSON BOM file which has the changed `version` value of `2`:
@@ -1156,7 +1154,7 @@ In this example, only the `--from` clause is needed to select an object. The `-
11561154
is equivalent to using the wildcard character (which may need to be enclosed in single or double quotes depending on your shell):
11571155

11581156
```bash
1159-
./sbom-utility query -i test/cyclonedx/cdx-1-4-mature-example-1.json --select '*' --from metadata.component --quiet
1157+
./sbom-utility query -i test/cyclonedx/cdx-1-4-mature-example-1.json --select '*' --from metadata.component -q
11601158
```
11611159

11621160
```json
@@ -1191,7 +1189,7 @@ is equivalent to using the wildcard character (which may need to be enclosed in
11911189
In this example, the `--from` clause references the top-level `metadata.supplier` object.
11921190

11931191
```bash
1194-
./sbom-utility query -i test/cyclonedx/cdx-1-4-mature-example-1.json --from metadata.supplier --quiet
1192+
./sbom-utility query -i test/cyclonedx/cdx-1-4-mature-example-1.json --from metadata.supplier -q
11951193
```
11961194

11971195
```json
@@ -1213,7 +1211,7 @@ In this example, the `--from` clause references the top-level `metadata.supplier
12131211
In this example, the `--from` clause references the singleton JSON object `component` found under the top-level `metadata` object. It then reduces the resultant JSON object to only return the `name` and `value` fields and their values as requested on the `--select` clause.
12141212

12151213
```bash
1216-
./sbom-utility query --select name,version --from metadata.component -i examples/cyclonedx/SBOM/juice-shop-11.1.2/bom.json --quiet
1214+
./sbom-utility query --select name,version --from metadata.component -i examples/cyclonedx/SBOM/juice-shop-11.1.2/bom.json -q
12171215
```
12181216

12191217
```json
@@ -1228,7 +1226,7 @@ In this example, the `--from` clause references the singleton JSON object `compo
12281226
In this example, the `--from` filter will return the entire JSON components array.
12291227

12301228
```bash
1231-
./sbom-utility query -i test/cyclonedx/cdx-1-4-mature-example-1.json --from components --quiet
1229+
./sbom-utility query -i test/cyclonedx/cdx-1-4-mature-example-1.json --from components -q
12321230
```
12331231

12341232
```json
@@ -1278,7 +1276,7 @@ In this example, the `--from` filter will return the entire JSON components arra
12781276
In this example, the `--where` filter will be applied to a set of `properties` results to only include entries that match the specified regex.
12791277

12801278
```bash
1281-
./sbom-utility query -i test/cyclonedx/cdx-1-4-mature-example-1.json --from metadata.properties --where name=urn:example.com:classification --quiet
1279+
./sbom-utility query -i test/cyclonedx/cdx-1-4-mature-example-1.json --from metadata.properties --where name=urn:example.com:classification -q
12821280
```
12831281

12841282
```json
@@ -1293,7 +1291,7 @@ In this example, the `--where` filter will be applied to a set of `properties` r
12931291
additionally, you can apply a `--select` clause to simply obtain the matching entry's `value`:
12941292

12951293
```bash
1296-
./sbom-utility query -i test/cyclonedx/cdx-1-4-mature-example-1.json --select value --from metadata.properties --where name=urn:example.com:classification --quiet
1294+
./sbom-utility query -i test/cyclonedx/cdx-1-4-mature-example-1.json --select value --from metadata.properties --where name=urn:example.com:classification -q
12971295
```
12981296

12991297
```json
@@ -1327,7 +1325,7 @@ Currently, all `resource list` command results are sorted by resource `type` the
13271325
#### Example: resource list
13281326

13291327
```bash
1330-
./sbom-utility resource list -i test/cyclonedx/cdx-1-3-resource-list.json --quiet
1328+
./sbom-utility resource list -i test/cyclonedx/cdx-1-3-resource-list.json -q
13311329
```
13321330

13331331
```bash
@@ -1354,7 +1352,7 @@ service Foo Foo service
13541352
This example uses the `type` flag to specific `service`. The other valid type is `component`. Future versions of CycloneDX schema will include more resource types such as "ml" (machine learning) or "tool".
13551353

13561354
```bash
1357-
./sbom-utility resource list -i test/cyclonedx/cdx-1-3-resource-list.json --type service --quiet
1355+
./sbom-utility resource list -i test/cyclonedx/cdx-1-3-resource-list.json --type service -q
13581356
```
13591357

13601358
```bash
@@ -1367,15 +1365,15 @@ service Foo Foo service service:example.com/myservi
13671365
**Note** The results would be equivalent to using the `--where` filter:
13681366

13691367
```bash
1370-
./sbom-utility resource list -i test/cyclonedx/cdx-1-3-resource-list.json --where "resource-type=service" --quiet
1368+
./sbom-utility resource list -i test/cyclonedx/cdx-1-3-resource-list.json --where "resource-type=service" -q
13711369
```
13721370

13731371
##### Example: list with `name` regex match
13741372

13751373
This example uses the `where` filter on the `name` field. In this case we supply an exact "startswith" regex. for the `name` filter.
13761374

13771375
```bash
1378-
./sbom-utility resource list -i test/cyclonedx/cdx-1-3-resource-list.json --where "name=Library A" --quiet
1376+
./sbom-utility resource list -i test/cyclonedx/cdx-1-3-resource-list.json --where "name=Library A" -q
13791377
```
13801378

13811379
```bash
@@ -1571,7 +1569,7 @@ Output BOM results without `properties`:
15711569
##### Example: Trim `name` and `description` from entire JSON BOM
15721570

15731571
```bash
1574-
./sbom-utility trim -i test/trim/trim-cdx-1-5-sample-small-components-only.sbom.json --keys=name,description --quiet
1572+
./sbom-utility trim -i test/trim/trim-cdx-1-5-sample-small-components-only.sbom.json --keys=name,description -q
15751573
```
15761574

15771575
Output BOM results without `name` or `description`:
@@ -1618,7 +1616,7 @@ Output BOM results without `name` or `description`:
16181616
##### Example: Trim `properties` from only `components` path
16191617

16201618
```bash
1621-
./sbom-utility trim -i test/trim/trim-cdx-1-5-sample-small-components-only.sbom.json --keys=properties --from components --quiet
1619+
./sbom-utility trim -i test/trim/trim-cdx-1-5-sample-small-components-only.sbom.json --keys=properties --from components -q
16221620
```
16231621

16241622
Output BOM results with `properties` removed from all `components`:
@@ -2023,7 +2021,7 @@ The details include the full context of the failing `metadata.properties` object
20232021
The JSON format will provide an `array` of schema error results that can be post-processed as part of validation toolchain.
20242022

20252023
```bash
2026-
./sbom-utility validate -i test/validation/cdx-1-4-validate-err-components-unique-items-1.json --format json --quiet
2024+
./sbom-utility validate -i test/validation/cdx-1-4-validate-err-components-unique-items-1.json --format json -q
20272025
```
20282026

20292027
```json
@@ -2100,7 +2098,7 @@ In many cases, BOMs may have many errors and having the `value` information deta
21002098
Rerunning the same command with this flag set to false yields a reduced set of information.
21012099

21022100
```bash
2103-
./sbom-utility validate -i test/validation/cdx-1-4-validate-err-components-unique-items-1.json --format json --error-value=false --quiet
2101+
./sbom-utility validate -i test/validation/cdx-1-4-validate-err-components-unique-items-1.json --format json --error-value=false -q
21042102
```
21052103

21062104
```json
@@ -2144,7 +2142,7 @@ Use the `--format` flag on the to choose one of the supported output formats:
21442142
The `list` subcommand provides a complete view of most top-level, vulnerability fields.
21452143

21462144
```bash
2147-
./sbom-utility vulnerability list -i test/vex/cdx-1-3-example1-bom-vex.json --quiet
2145+
./sbom-utility vulnerability list -i test/vex/cdx-1-3-example1-bom-vex.json -q
21482146
```
21492147

21502148
```bash
@@ -2160,7 +2158,7 @@ CVE-2020-25649 611 CVSSv31: 7.5 (high), CVSSv31: 8.2 (high), CVSS
21602158
This example shows the default text output from using the `--summary` flag:
21612159
21622160
```bash
2163-
./sbom-utility vulnerability list -i test/vex/cdx-1-3-example1-bom-vex.json --quiet --summary
2161+
./sbom-utility vulnerability list -i test/vex/cdx-1-3-example1-bom-vex.json --summary -q
21642162
```
21652163
21662164
```bash
@@ -2174,7 +2172,7 @@ CVE-2020-25649 CVSSv31: 7.5 (high) NVD 2020-12-03 com.fasterxml.jack
21742172
##### Example: Vulnerability list with `--where` filter with `description` key
21752173
21762174
```bash
2177-
./sbom-utility vulnerability list -i test/vex/cdx-1-3-example1-bom-vex.json --quiet --where description=XXE
2175+
./sbom-utility vulnerability list -i test/vex/cdx-1-3-example1-bom-vex.json --where description=XXE -q
21782176
```
21792177
21802178
```bash
@@ -2186,7 +2184,7 @@ CVE-2020-25649 611 CVSSv31: 7.5 (high), CVSSv31: 8.2 (high), CVSS
21862184
##### Example: Vulnerability list with `--where` filter with `analysis-state` key
21872185
21882186
```bash
2189-
./sbom-utility vulnerability list -i test/vex/cdx-1-3-example1-bom-vex.json --quiet --where analysis-state=not_affected
2187+
./sbom-utility vulnerability list -i test/vex/cdx-1-3-example1-bom-vex.json --where analysis-state=not_affected -q
21902188
```
21912189
21922190
```bash
@@ -2264,7 +2262,7 @@ Use the `--format` flag on the to choose one of the supported output formats:
22642262
##### Example: Add, delete and modify
22652263
22662264
```bash
2267-
./sbom-utility diff -i test/diff/json-array-order-change-with-add-and-delete-base.json -r test/diff/json-array-order-change-with-add-and-delete-delta.json --quiet --format txt --colorize=true
2265+
./sbom-utility diff -i test/diff/json-array-order-change-with-add-and-delete-base.json -r test/diff/json-array-order-change-with-add-and-delete-delta.json --format txt --colorize=true -q
22682266
```
22692267
22702268
```bash
@@ -2576,16 +2574,16 @@ Simply append the flags `--args --trace` or `--args --debug` to your `go test` c
25762574
go test github.com/CycloneDX/sbom-utility/cmd -v --args --trace
25772575
```
25782576
2577+
**Note**: You should always use the `--args` flag of `go test` as this will assure non-conflict with `go test` built-in flags which is the case with the `--trace` flag.
2578+
25792579
#### Eliminating extraneous test output
25802580
25812581
Several tests will still output error and warning messages as designed. If these messages are distracting, you can turn them off using the `--quiet` flag.
25822582
25832583
```bash
2584-
go test github.com/CycloneDX/sbom-utility/cmd -v --args --quiet
2584+
go test github.com/CycloneDX/sbom-utility/cmd -v --quiet
25852585
```
25862586
2587-
**Note**: Always use the `--args` flag of `go test` as this will assure non-conflict with built-in flags.
2588-
25892587
---
25902588
25912589
#### Releasing

0 commit comments

Comments
 (0)