Skip to content

Commit 307c415

Browse files
author
Christophe Guerreiro
committed
doc: Update INSTALL.md and README.md for console output and JSON handling
Signed-off-by: Christophe Guerreiro <christophe.guerreiro@non.se.com>
1 parent 9a0c71f commit 307c415

2 files changed

Lines changed: 15 additions & 16 deletions

File tree

INSTALL.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ After installation:
4646
# Show help
4747
spdx-diff --help
4848

49-
# Compare two SPDX files
49+
# Compare two SPDX files, human-readable output on stderr and JSON output on stdout
5050
spdx-diff reference.json new.json
5151

52-
# JSON output for automation
53-
spdx-diff reference.json new.json --format json --output results.json
52+
# With JSON file output generated
53+
spdx-diff reference.json new.json --json-output results.json
5454
```
5555

5656
See `README.md` for full documentation.

README.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ This tool compares two SPDX3 JSON documents and reports differences in:
88
- Kernel configuration parameters (CONFIG_*)
99
- PACKAGECONFIG entries per package
1010

11-
It produces both human-readable output (console) and a structured JSON diff file.
11+
The application separates human-readable and machine-readable outputs to improve automation and pipeline integration.
12+
13+
- **stderr** is used for human-readable (text) output intended for debugging.
14+
- **stdout** always emits structured **JSON output**, making it suitable for consumption by scripts and CI/CD pipelines.
15+
- When a JSON filename parameter is provided, the JSON result is also written to the specified file.
1216

1317
Usage
1418
-----
@@ -21,12 +25,7 @@ Required arguments:
2125
- `new`: Path to the newer SPDX3 JSON file.
2226

2327
Optional arguments:
24-
- `--output <file>`: Save diff results to the given JSON file.
25-
Default: `spdx_diff_<timestamp>.json`
26-
- `--format {text,json,both}`: Control output format:
27-
- `text`: Console output only (no JSON file)
28-
- `json`: JSON file only (silent mode for automation)
29-
- `both`: Both console and JSON output (**default**)
28+
- `--json-output <file>`: Save diff results to the given JSON file.
3029

3130
Text output filtering - category :
3231
- `--[no-]packages`: show|hide package differences.
@@ -128,22 +127,22 @@ The script uses Python's logging module:
128127
Examples
129128
--------
130129

131-
### Basic comparison with both console and JSON output:
130+
### Basic comparison with both console(stderr) and JSON(stdout) output:
132131
./spdx-diff reference.json new.json
133132

134133
### Full details with proprietary packages excluded:
135134
./spdx-diff reference.json new.json --no-packages-proprietary
136135

137-
### Silent mode for CI/CD (JSON output only):
138-
./spdx-diff reference.json new.json --format json --output results.json
136+
### Console output for CI/CD:
137+
./spdx-diff reference.json new.json --quiet
139138

140-
### Console output only (no JSON file):
141-
./spdx-diff reference.json new.json --format text
139+
### Console and JSON output with JSON file generated:
140+
./spdx-diff reference.json new.json --quiet --json-output result.json
142141

143142
### Show on console no PACKAGECONFIG differences:
144143
./spdx-diff reference.json new.json --no-packageconfig
145144

146-
Console output example:
145+
Console output(stderr) example:
147146
```
148147
Packages - Added:
149148
+ libfoo: 2.0

0 commit comments

Comments
 (0)