Skip to content

Commit

Permalink
Be more precise about exit codes.
Browse files Browse the repository at this point in the history
  • Loading branch information
s-l-teichmann committed Dec 4, 2024
1 parent 938ceb8 commit 16e8605
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions cmd/csaf_validator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import (
)

const (
exitCodeAllValid = 0
exitCodeSchemaInvalid = 1 << 0
exitCodeNoRemoteValidator = 1 << 1
exitCodeFailedRemoteValidation = 1 << 2
exitCodeSchemaInvalid = 1 << iota
exitCodeNoRemoteValidator
exitCodeFailedRemoteValidation
exitCodeAllValid = 0
)

type options struct {
Expand Down
10 changes: 5 additions & 5 deletions docs/csaf_validator.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
is a tool to validate local advisories files against the JSON Schema and an optional remote validator.

### Exit codes
If no fatal error occurs the program will exit with the following codes:
- `0`: all valid
- `2⁰`: schema invalid
- ``: no remote validator configured
- ``: failure in remote validation
If no fatal error occurs the program will exit with an exit code `n` with the following conditions:
- `n == 0`: all valid
- `(n / 2) % 1 == 1`: schema validation failed
- `(n / 4) % 1 == 1`: no remote validator configured
- `(n / 8) % 1 == 1`: failure in remote validation

### Usage

Expand Down

0 comments on commit 16e8605

Please sign in to comment.