Skip to content

Commit 086c4ab

Browse files
JanHoefelmeyerJanHoefelmeyer
and
JanHoefelmeyer
authored
Convert a lot of command line arguments to snake case (gocsaf#498)
* Convert a lot of variables to snake case * Add snakecase for variables made out of two words that had it in no version yet (for consistency) * Adjust example files too --------- Co-authored-by: JanHoefelmeyer <[email protected]>
1 parent 77cc250 commit 086c4ab

File tree

13 files changed

+83
-83
lines changed

13 files changed

+83
-83
lines changed

cmd/csaf_aggregator/config.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ type provider struct {
5454
UpdateInterval *string `toml:"update_interval"`
5555

5656
// IgnorePattern is a list of patterns of advisory URLs to be ignored.
57-
IgnorePattern []string `toml:"ignorepattern"`
57+
IgnorePattern []string `toml:"ignore_pattern"`
5858

5959
// ExtraHeader adds extra HTTP header fields to client
6060
ExtraHeader http.Header `toml:"header"`
@@ -63,7 +63,7 @@ type provider struct {
6363
ClientKey *string `toml:"client_key"`
6464
ClientPassphrase *string `toml:"client_passphrase"`
6565

66-
Range *models.TimeRange `toml:"timerange"`
66+
Range *models.TimeRange `toml:"time_range"`
6767

6868
clientCerts []tls.Certificate
6969
ignorePattern filter.PatternMatcher
@@ -92,7 +92,7 @@ type config struct {
9292
ClientKey *string `toml:"client_key"`
9393
ClientPassphrase *string `toml:"client_passphrase"`
9494

95-
Range *models.TimeRange `long:"timerange" short:"t" description:"RANGE of time from which advisories to download" value-name:"RANGE" toml:"timerange"`
95+
Range *models.TimeRange `long:"time_range" short:"t" description:"RANGE of time from which advisories to download" value-name:"RANGE" toml:"time_range"`
9696

9797
// LockFile tries to lock to a given file.
9898
LockFile *string `toml:"lock_file"`
@@ -116,7 +116,7 @@ type config struct {
116116
UpdateInterval *string `toml:"update_interval"`
117117

118118
// IgnorePattern is a list of patterns of advisory URLs to be ignored.
119-
IgnorePattern []string `toml:"ignorepattern"`
119+
IgnorePattern []string `toml:"ignore_pattern"`
120120

121121
// ExtraHeader adds extra HTTP header fields to client
122122
ExtraHeader http.Header `toml:"header"`

cmd/csaf_checker/config.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,18 @@ type config struct {
3131
//lint:ignore SA5008 We are using choice twice: json, html.
3232
Format outputFormat `short:"f" long:"format" choice:"json" choice:"html" description:"Format of report" toml:"format"`
3333
Insecure bool `long:"insecure" description:"Do not check TLS certificates from provider" toml:"insecure"`
34-
ClientCert *string `long:"client-cert" description:"TLS client certificate file (PEM encoded data)" value-name:"CERT-FILE" toml:"client_cert"`
35-
ClientKey *string `long:"client-key" description:"TLS client private key file (PEM encoded data)" value-name:"KEY-FILE" toml:"client_key"`
36-
ClientPassphrase *string `long:"client-passphrase" description:"Optional passphrase for the client cert (limited, experimental, see downloader doc)" value-name:"PASSPHRASE" toml:"client_passphrase"`
34+
ClientCert *string `long:"client_cert" description:"TLS client certificate file (PEM encoded data)" value-name:"CERT-FILE" toml:"client_cert"`
35+
ClientKey *string `long:"client_key" description:"TLS client private key file (PEM encoded data)" value-name:"KEY-FILE" toml:"client_key"`
36+
ClientPassphrase *string `long:"client_passphrase" description:"Optional passphrase for the client cert (limited, experimental, see downloader doc)" value-name:"PASSPHRASE" toml:"client_passphrase"`
3737
Version bool `long:"version" description:"Display version of the binary" toml:"-"`
3838
Verbose bool `long:"verbose" short:"v" description:"Verbose output" toml:"verbose"`
3939
Rate *float64 `long:"rate" short:"r" description:"The average upper limit of https operations per second (defaults to unlimited)" toml:"rate"`
40-
Range *models.TimeRange `long:"timerange" short:"t" description:"RANGE of time from which advisories to download" value-name:"RANGE" toml:"timerange"`
41-
IgnorePattern []string `long:"ignorepattern" short:"i" description:"Do not download files if their URLs match any of the given PATTERNs" value-name:"PATTERN" toml:"ignorepattern"`
40+
Range *models.TimeRange `long:"time_range" short:"t" description:"RANGE of time from which advisories to download" value-name:"RANGE" toml:"time_range"`
41+
IgnorePattern []string `long:"ignore_pattern" short:"i" description:"Do not download files if their URLs match any of the given PATTERNs" value-name:"PATTERN" toml:"ignore_pattern"`
4242
ExtraHeader http.Header `long:"header" short:"H" description:"One or more extra HTTP header fields" toml:"header"`
4343
RemoteValidator string `long:"validator" description:"URL to validate documents remotely" value-name:"URL" toml:"validator"`
44-
RemoteValidatorCache string `long:"validatorcache" description:"FILE to cache remote validations" value-name:"FILE" toml:"validator_cache"`
45-
RemoteValidatorPresets []string `long:"validatorpreset" description:"One or more presets to validate remotely" toml:"validator_preset"`
44+
RemoteValidatorCache string `long:"validator_cache" description:"FILE to cache remote validations" value-name:"FILE" toml:"validator_cache"`
45+
RemoteValidatorPresets []string `long:"validator_preset" description:"One or more presets to validate remotely" toml:"validator_preset"`
4646

4747
Config string `short:"c" long:"config" description:"Path to config TOML file" value-name:"TOML-FILE" toml:"-"`
4848

cmd/csaf_downloader/config.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,34 +44,34 @@ const (
4444
type config struct {
4545
Directory string `short:"d" long:"directory" description:"DIRectory to store the downloaded files in" value-name:"DIR" toml:"directory"`
4646
Insecure bool `long:"insecure" description:"Do not check TLS certificates from provider" toml:"insecure"`
47-
IgnoreSignatureCheck bool `long:"ignoresigcheck" description:"Ignore signature check results, just warn on mismatch" toml:"ignoresigcheck"`
48-
ClientCert *string `long:"client-cert" description:"TLS client certificate file (PEM encoded data)" value-name:"CERT-FILE" toml:"client_cert"`
49-
ClientKey *string `long:"client-key" description:"TLS client private key file (PEM encoded data)" value-name:"KEY-FILE" toml:"client_key"`
50-
ClientPassphrase *string `long:"client-passphrase" description:"Optional passphrase for the client cert (limited, experimental, see doc)" value-name:"PASSPHRASE" toml:"client_passphrase"`
47+
IgnoreSignatureCheck bool `long:"ignore_sigcheck" description:"Ignore signature check results, just warn on mismatch" toml:"ignore_sigcheck"`
48+
ClientCert *string `long:"client_cert" description:"TLS client certificate file (PEM encoded data)" value-name:"CERT-FILE" toml:"client_cert"`
49+
ClientKey *string `long:"client_key" description:"TLS client private key file (PEM encoded data)" value-name:"KEY-FILE" toml:"client_key"`
50+
ClientPassphrase *string `long:"client_passphrase" description:"Optional passphrase for the client cert (limited, experimental, see doc)" value-name:"PASSPHRASE" toml:"client_passphrase"`
5151
Version bool `long:"version" description:"Display version of the binary" toml:"-"`
52-
NoStore bool `long:"nostore" short:"n" description:"Do not store files" toml:"no_store"`
52+
NoStore bool `long:"no_store" short:"n" description:"Do not store files" toml:"no_store"`
5353
Rate *float64 `long:"rate" short:"r" description:"The average upper limit of https operations per second (defaults to unlimited)" toml:"rate"`
5454
Worker int `long:"worker" short:"w" description:"NUMber of concurrent downloads" value-name:"NUM" toml:"worker"`
55-
Range *models.TimeRange `long:"timerange" short:"t" description:"RANGE of time from which advisories to download" value-name:"RANGE" toml:"timerange"`
55+
Range *models.TimeRange `long:"time_range" short:"t" description:"RANGE of time from which advisories to download" value-name:"RANGE" toml:"time_range"`
5656
Folder string `long:"folder" short:"f" description:"Download into a given subFOLDER" value-name:"FOLDER" toml:"folder"`
57-
IgnorePattern []string `long:"ignorepattern" short:"i" description:"Do not download files if their URLs match any of the given PATTERNs" value-name:"PATTERN" toml:"ignorepattern"`
57+
IgnorePattern []string `long:"ignore_pattern" short:"i" description:"Do not download files if their URLs match any of the given PATTERNs" value-name:"PATTERN" toml:"ignore_pattern"`
5858
ExtraHeader http.Header `long:"header" short:"H" description:"One or more extra HTTP header fields" toml:"header"`
5959

6060
RemoteValidator string `long:"validator" description:"URL to validate documents remotely" value-name:"URL" toml:"validator"`
61-
RemoteValidatorCache string `long:"validatorcache" description:"FILE to cache remote validations" value-name:"FILE" toml:"validatorcache"`
62-
RemoteValidatorPresets []string `long:"validatorpreset" description:"One or more PRESETS to validate remotely" value-name:"PRESETS" toml:"validatorpreset"`
61+
RemoteValidatorCache string `long:"validator_cache" description:"FILE to cache remote validations" value-name:"FILE" toml:"validator_cache"`
62+
RemoteValidatorPresets []string `long:"validator_preset" description:"One or more PRESETS to validate remotely" value-name:"PRESETS" toml:"validator_preset"`
6363

6464
//lint:ignore SA5008 We are using choice twice: strict, unsafe.
65-
ValidationMode validationMode `long:"validationmode" short:"m" choice:"strict" choice:"unsafe" value-name:"MODE" description:"MODE how strict the validation is" toml:"validation_mode"`
65+
ValidationMode validationMode `long:"validation_mode" short:"m" choice:"strict" choice:"unsafe" value-name:"MODE" description:"MODE how strict the validation is" toml:"validation_mode"`
6666

67-
ForwardURL string `long:"forwardurl" description:"URL of HTTP endpoint to forward downloads to" value-name:"URL" toml:"forward_url"`
68-
ForwardHeader http.Header `long:"forwardheader" description:"One or more extra HTTP header fields used by forwarding" toml:"forward_header"`
69-
ForwardQueue int `long:"forwardqueue" description:"Maximal queue LENGTH before forwarder" value-name:"LENGTH" toml:"forward_queue"`
70-
ForwardInsecure bool `long:"forwardinsecure" description:"Do not check TLS certificates from forward endpoint" toml:"forward_insecure"`
67+
ForwardURL string `long:"forward_url" description:"URL of HTTP endpoint to forward downloads to" value-name:"URL" toml:"forward_url"`
68+
ForwardHeader http.Header `long:"forward_header" description:"One or more extra HTTP header fields used by forwarding" toml:"forward_header"`
69+
ForwardQueue int `long:"forward_queue" description:"Maximal queue LENGTH before forwarder" value-name:"LENGTH" toml:"forward_queue"`
70+
ForwardInsecure bool `long:"forward_insecure" description:"Do not check TLS certificates from forward endpoint" toml:"forward_insecure"`
7171

72-
LogFile *string `long:"logfile" description:"FILE to log downloading to" value-name:"FILE" toml:"log_file"`
72+
LogFile *string `long:"log_file" description:"FILE to log downloading to" value-name:"FILE" toml:"log_file"`
7373
//lint:ignore SA5008 We are using choice or than once: debug, info, warn, error
74-
LogLevel *options.LogLevel `long:"loglevel" description:"LEVEL of logging details" value-name:"LEVEL" choice:"debug" choice:"info" choice:"warn" choice:"error" toml:"log_level"`
74+
LogLevel *options.LogLevel `long:"log_level" description:"LEVEL of logging details" value-name:"LEVEL" choice:"debug" choice:"info" choice:"warn" choice:"error" toml:"log_level"`
7575

7676
Config string `short:"c" long:"config" description:"Path to config TOML file" value-name:"TOML-FILE" toml:"-"`
7777

cmd/csaf_uploader/config.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,18 @@ type config struct {
3535
URL string `short:"u" long:"url" description:"URL of the CSAF provider" value-name:"URL" toml:"url"`
3636
//lint:ignore SA5008 We are using choice many times: csaf, white, green, amber, red.
3737
TLP string `short:"t" long:"tlp" choice:"csaf" choice:"white" choice:"green" choice:"amber" choice:"red" description:"TLP of the feed" toml:"tlp"`
38-
ExternalSigned bool `short:"x" long:"external-signed" description:"CSAF files are signed externally. Assumes .asc files beside CSAF files." toml:"external_signed"`
39-
NoSchemaCheck bool `short:"s" long:"no-schema-check" description:"Do not check files against CSAF JSON schema locally." toml:"no_schema_check"`
38+
ExternalSigned bool `short:"x" long:"external_signed" description:"CSAF files are signed externally. Assumes .asc files beside CSAF files." toml:"external_signed"`
39+
NoSchemaCheck bool `short:"s" long:"no_schema_check" description:"Do not check files against CSAF JSON schema locally." toml:"no_schema_check"`
4040

4141
Key *string `short:"k" long:"key" description:"OpenPGP key to sign the CSAF files" value-name:"KEY-FILE" toml:"key"`
4242
Password *string `short:"p" long:"password" description:"Authentication password for accessing the CSAF provider" value-name:"PASSWORD" toml:"password"`
4343
Passphrase *string `short:"P" long:"passphrase" description:"Passphrase to unlock the OpenPGP key" value-name:"PASSPHRASE" toml:"passphrase"`
44-
ClientCert *string `long:"client-cert" description:"TLS client certificate file (PEM encoded data)" value-name:"CERT-FILE.crt" toml:"client_cert"`
45-
ClientKey *string `long:"client-key" description:"TLS client private key file (PEM encoded data)" value-name:"KEY-FILE.pem" toml:"client_key"`
46-
ClientPassphrase *string `long:"client-passphrase" description:"Optional passphrase for the client cert (limited, experimental, see downloader doc)" value-name:"PASSPHRASE" toml:"client_passphrase"`
44+
ClientCert *string `long:"client_cert" description:"TLS client certificate file (PEM encoded data)" value-name:"CERT-FILE.crt" toml:"client_cert"`
45+
ClientKey *string `long:"client_key" description:"TLS client private key file (PEM encoded data)" value-name:"KEY-FILE.pem" toml:"client_key"`
46+
ClientPassphrase *string `long:"client_passphrase" description:"Optional passphrase for the client cert (limited, experimental, see downloader doc)" value-name:"PASSPHRASE" toml:"client_passphrase"`
4747

48-
PasswordInteractive bool `short:"i" long:"password-interactive" description:"Enter password interactively" toml:"password_interactive"`
49-
PassphraseInteractive bool `short:"I" long:"passphrase-interactive" description:"Enter OpenPGP key passphrase interactively" toml:"passphrase_interactive"`
48+
PasswordInteractive bool `short:"i" long:"password_interactive" description:"Enter password interactively" toml:"password_interactive"`
49+
PassphraseInteractive bool `short:"I" long:"passphrase_interactive" description:"Enter OpenPGP key passphrase interactively" toml:"passphrase_interactive"`
5050

5151
Insecure bool `long:"insecure" description:"Do not check TLS certificates from provider" toml:"insecure"`
5252

cmd/csaf_validator/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ import (
2525
type options struct {
2626
Version bool `long:"version" description:"Display version of the binary"`
2727
RemoteValidator string `long:"validator" description:"URL to validate documents remotely" value-name:"URL"`
28-
RemoteValidatorCache string `long:"validatorcache" description:"FILE to cache remote validations" value-name:"FILE"`
29-
RemoteValidatorPresets []string `long:"validatorpreset" description:"One or more presets to validate remotely" default:"mandatory"`
28+
RemoteValidatorCache string `long:"validator_cache" description:"FILE to cache remote validations" value-name:"FILE"`
29+
RemoteValidatorPresets []string `long:"validator_preset" description:"One or more presets to validate remotely" default:"mandatory"`
3030
Output string `short:"o" long:"output" description:"If a remote validator was used, display AMOUNT ('all', 'important' or 'short') results" value-name:"AMOUNT"`
3131
}
3232

docs/csaf_aggregator.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
csaf_aggregator [OPTIONS]
77
88
Application Options:
9-
-t, --timerange=RANGE RANGE of time from which advisories to download
9+
-t, --time_range=RANGE RANGE of time from which advisories to download
1010
-i, --interim Perform an interim scan
1111
--version Display version of the binary
1212
-c, --config=TOML-FILE Path to config TOML file
@@ -104,12 +104,12 @@ lock_file // path to lockfile, to stop other instances if one is n
104104
interim_years // limiting the years for which interim documents are searched (default 0)
105105
verbose // print more diagnostic output, e.g. https requests (default false)
106106
allow_single_provider // debugging option (default false)
107-
ignorepattern // patterns of advisory URLs to be ignored (see checker doc for details)
107+
ignore_pattern // patterns of advisory URLs to be ignored (see checker doc for details)
108108
client_cert // path to client certificate to access access-protected advisories
109109
client_key // path to client key to access access-protected advisories
110110
client_passphrase // optional client cert passphrase (limited, experimental, see downloader doc)
111111
header // adds extra HTTP header fields to the client
112-
timerange // Accepted time range of advisories to handle. See downloader docs for details.
112+
time_range // Accepted time range of advisories to handle. See downloader docs for details.
113113
```
114114

115115
Next we have two TOML _tables_:
@@ -139,7 +139,7 @@ category
139139
update_interval
140140
create_service_document
141141
categories
142-
ignorepattern
142+
ignore_pattern
143143
client_cert
144144
client_key
145145
client_passphrase
@@ -229,7 +229,7 @@ insecure = true
229229
# If aggregator.category == "aggregator", set for an entry that should
230230
# be listed in addition:
231231
category = "lister"
232-
# ignorepattern = [".*white.*", ".*red.*"]
232+
# ignore_pattern = [".*white.*", ".*red.*"]
233233
```
234234
<!-- MARKDOWN-AUTO-DOCS:END -->
235235

docs/csaf_checker.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ Application Options:
1010
-o, --output=REPORT-FILE File name of the generated report
1111
-f, --format=[json|html] Format of report (default: json)
1212
--insecure Do not check TLS certificates from provider
13-
--client-cert=CERT-FILE TLS client certificate file (PEM encoded data)
14-
--client-key=KEY-FILE TLS client private key file (PEM encoded data)
15-
--client-passphrase=PASSPHRASE Optional passphrase for the client cert (limited, experimental, see downloader doc)
13+
--client_cert=CERT-FILE TLS client certificate file (PEM encoded data)
14+
--client_key=KEY-FILE TLS client private key file (PEM encoded data)
15+
--client_passphrase=PASSPHRASE Optional passphrase for the client cert (limited, experimental, see downloader doc)
1616
--version Display version of the binary
1717
-v, --verbose Verbose output
1818
-r, --rate= The average upper limit of https operations per second (defaults to unlimited)
19-
-t, --timerange=RANGE RANGE of time from which advisories to download
20-
-i, --ignorepattern=PATTERN Do not download files if their URLs match any of the given PATTERNs
19+
-t, --time_range=RANGE RANGE of time from which advisories to download
20+
-i, --ignore_pattern=PATTERN Do not download files if their URLs match any of the given PATTERNs
2121
-H, --header= One or more extra HTTP header fields
2222
--validator=URL URL to validate documents remotely
23-
--validatorcache=FILE FILE to cache remote validations
24-
--validatorpreset= One or more presets to validate remotely (default: [mandatory])
23+
--validator_cache=FILE FILE to cache remote validations
24+
--validator_preset= One or more presets to validate remotely (default: [mandatory])
2525
-c, --config=TOML-FILE Path to config TOML file
2626
2727
Help Options:
@@ -50,7 +50,7 @@ insecure = false
5050
# client_passphrase # not set by default
5151
verbose = false
5252
# rate # not set by default
53-
# timerange # not set by default
53+
# time_range # not set by default
5454
# header # not set by default
5555
# validator # not set by default
5656
# validator_cache # not set by default

0 commit comments

Comments
 (0)