1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 11:55:40 +01:00

Add docs and fix output.

This commit is contained in:
Sascha L. Teichmann 2023-08-01 09:54:43 +02:00
parent 2864176111
commit 8aa31984df
3 changed files with 18 additions and 3 deletions

View file

@ -10,6 +10,7 @@ package main
import ( import (
"fmt" "fmt"
"log"
"net/http" "net/http"
"regexp" "regexp"
@ -94,6 +95,9 @@ func (cfg *config) compileIgnorePatterns() error {
if err != nil { if err != nil {
return fmt.Errorf("invalid ignorepattern: %w", err) return fmt.Errorf("invalid ignorepattern: %w", err)
} }
if cfg.Verbose {
log.Printf("ignore advisories containing pattern %q\n", expr)
}
cfg.ignorePattern = append(cfg.ignorePattern, expr) cfg.ignorePattern = append(cfg.ignorePattern, expr)
} }
return nil return nil

View file

@ -349,7 +349,7 @@ nextAdvisory:
if d.cfg.ignoreURL(file.URL()) { if d.cfg.ignoreURL(file.URL()) {
if d.cfg.Verbose { if d.cfg.Verbose {
log.Printf("Igoring %q.\n", file.URL()) log.Printf("Ignoring %q.\n", file.URL())
} }
continue continue
} }

View file

@ -16,6 +16,7 @@ Application Options:
-w, --worker=NUM NUMber of concurrent downloads (default: 2) -w, --worker=NUM NUMber of concurrent downloads (default: 2)
-t, --timerange=RANGE RANGE of time from which advisories to download -t, --timerange=RANGE RANGE of time from which advisories to download
-f, --folder=FOLDER Download into a given FOLDER -f, --folder=FOLDER Download into a given FOLDER
-i, --ignorepattern=PATTERN Dont download files if there URLs match any of the given PATTERNs
-H, --header= One or more extra HTTP header fields -H, --header= One or more extra HTTP header fields
--validator=URL URL to validate documents remotely --validator=URL URL to validate documents remotely
--validatorcache=FILE FILE to cache remote validations --validatorcache=FILE FILE to cache remote validations
@ -52,11 +53,13 @@ ignoresigcheck = false
verbose = false verbose = false
# rate # set to unlimited # rate # set to unlimited
worker = 2 worker = 2
# timerange # not set by default
# folder # not set by default
# ignorepattern # not set by default
# header # not set by default # header # not set by default
# validator # not set by default # validator # not set by default
# validatorcache # not set by default # validatorcache # not set by default
validatorpreset = ["mandatory"] validatorpreset = ["mandatory"]
# timerange # not set by default
``` ```
The `timerange` parameter enables downloading advisories which last changes falls The `timerange` parameter enables downloading advisories which last changes falls
@ -88,6 +91,14 @@ into a given intervall. There are three possible notations:
All interval boundaries are inclusive. All interval boundaries are inclusive.
if the `folder` option is given the advisories are stored in this folder. If the `folder` option is given the advisories are stored in this folder.
If it is omitted (by default) the advisories are stored in folder name by the If it is omitted (by default) the advisories are stored in folder name by the
year they are from. year they are from.
You can ignore certain advisories while downloading by specifying a list
of regular expressions to match their URLs by using the `ignorepattern` option.
E.g. `-i='.*white.*' -i='*.red.*'` will ignore files wich URLs contain the sub strings **white** or **red**.
In the config file this has to be noted as:
```
ignorepattern = [".*white.*", ".*red.*"]
```