Browse Source

Upgrade to clap 3

pull/57/head
Rodolphe Bréard 3 years ago
parent
commit
cfd5fabf0b
  1. 2
      acmed/Cargo.toml
  2. 20
      acmed/src/main.rs
  3. 2
      tacd/Cargo.toml
  4. 32
      tacd/src/main.rs

2
acmed/Cargo.toml

@ -23,7 +23,7 @@ openssl_vendored = ["crypto_openssl", "acme_common/openssl_vendored", "attohttpc
acme_common = { path = "../acme_common" } acme_common = { path = "../acme_common" }
attohttpc = { version = "0.18", default-features = false, features = ["charsets", "json"] } attohttpc = { version = "0.18", default-features = false, features = ["charsets", "json"] }
bincode = "1.3" bincode = "1.3"
clap = "2.32"
clap = "3.0"
glob = "0.3" glob = "0.3"
log = "0.4" log = "0.4"
nom = { version = "7.0", default-features = false, features = [] } nom = { version = "7.0", default-features = false, features = [] }

20
acmed/src/main.rs

@ -63,8 +63,8 @@ fn main() {
.version(APP_VERSION) .version(APP_VERSION)
.long_version(full_version.as_str()) .long_version(full_version.as_str())
.arg( .arg(
Arg::with_name("config")
.short("c")
Arg::new("config")
.short('c')
.long("config") .long("config")
.help("Path to the main configuration file") .help("Path to the main configuration file")
.takes_value(true) .takes_value(true)
@ -72,7 +72,7 @@ fn main() {
.default_value(DEFAULT_CONFIG_FILE), .default_value(DEFAULT_CONFIG_FILE),
) )
.arg( .arg(
Arg::with_name("log-level")
Arg::new("log-level")
.long("log-level") .long("log-level")
.help("Specify the log level") .help("Specify the log level")
.takes_value(true) .takes_value(true)
@ -81,25 +81,25 @@ fn main() {
.default_value(&default_log_level), .default_value(&default_log_level),
) )
.arg( .arg(
Arg::with_name("to-syslog")
Arg::new("to-syslog")
.long("log-syslog") .long("log-syslog")
.help("Sends log messages via syslog") .help("Sends log messages via syslog")
.conflicts_with("to-stderr"), .conflicts_with("to-stderr"),
) )
.arg( .arg(
Arg::with_name("to-stderr")
Arg::new("to-stderr")
.long("log-stderr") .long("log-stderr")
.help("Prints log messages to the standard error output") .help("Prints log messages to the standard error output")
.conflicts_with("log-syslog"), .conflicts_with("log-syslog"),
) )
.arg( .arg(
Arg::with_name("foreground")
.short("f")
Arg::new("foreground")
.short('f')
.long("foreground") .long("foreground")
.help("Runs in the foreground"), .help("Runs in the foreground"),
) )
.arg( .arg(
Arg::with_name("pid-file")
Arg::new("pid-file")
.long("pid-file") .long("pid-file")
.help("Path to the PID file") .help("Path to the PID file")
.takes_value(true) .takes_value(true)
@ -107,11 +107,11 @@ fn main() {
.default_value(DEFAULT_PID_FILE), .default_value(DEFAULT_PID_FILE),
) )
.arg( .arg(
Arg::with_name("root-cert")
Arg::new("root-cert")
.long("root-cert") .long("root-cert")
.help("Add a root certificate to the trust store (can be set multiple times)") .help("Add a root certificate to the trust store (can be set multiple times)")
.takes_value(true) .takes_value(true)
.multiple(true)
.multiple_occurrences(true)
.value_name("FILE"), .value_name("FILE"),
) )
.get_matches(); .get_matches();

2
tacd/Cargo.toml

@ -20,6 +20,6 @@ openssl_vendored = ["crypto_openssl", "acme_common/openssl_vendored"]
[dependencies] [dependencies]
acme_common = { path = "../acme_common" } acme_common = { path = "../acme_common" }
clap = "2.32"
clap = "3.0"
log = "0.4" log = "0.4"
openssl = "0.10" openssl = "0.10"

32
tacd/src/main.rs

@ -83,25 +83,25 @@ fn main() {
.version(APP_VERSION) .version(APP_VERSION)
.long_version(full_version.as_str()) .long_version(full_version.as_str())
.arg( .arg(
Arg::with_name("listen")
Arg::new("listen")
.long("listen") .long("listen")
.short("l")
.short('l')
.help("Host and port to listen on") .help("Host and port to listen on")
.takes_value(true) .takes_value(true)
.value_name("host:port|unix:path") .value_name("host:port|unix:path")
.default_value(DEFAULT_LISTEN_ADDR), .default_value(DEFAULT_LISTEN_ADDR),
) )
.arg( .arg(
Arg::with_name("domain")
Arg::new("domain")
.long("domain") .long("domain")
.short("d")
.short('d')
.help("The domain that is being validated") .help("The domain that is being validated")
.takes_value(true) .takes_value(true)
.value_name("STRING") .value_name("STRING")
.conflicts_with("domain-file"), .conflicts_with("domain-file"),
) )
.arg( .arg(
Arg::with_name("domain-file")
Arg::new("domain-file")
.long("domain-file") .long("domain-file")
.help("File from which is read the domain that is being validated") .help("File from which is read the domain that is being validated")
.takes_value(true) .takes_value(true)
@ -109,16 +109,16 @@ fn main() {
.conflicts_with("domain"), .conflicts_with("domain"),
) )
.arg( .arg(
Arg::with_name("acme-ext")
Arg::new("acme-ext")
.long("acme-ext") .long("acme-ext")
.short("e")
.short('e')
.help("The acmeIdentifier extension to set in the self-signed certificate") .help("The acmeIdentifier extension to set in the self-signed certificate")
.takes_value(true) .takes_value(true)
.value_name("STRING") .value_name("STRING")
.conflicts_with("acme-ext-file"), .conflicts_with("acme-ext-file"),
) )
.arg( .arg(
Arg::with_name("acme-ext-file")
Arg::new("acme-ext-file")
.long("acme-ext-file") .long("acme-ext-file")
.help("File from which is read the acmeIdentifier extension to set in the self-signed certificate") .help("File from which is read the acmeIdentifier extension to set in the self-signed certificate")
.takes_value(true) .takes_value(true)
@ -126,7 +126,7 @@ fn main() {
.conflicts_with("acme-ext"), .conflicts_with("acme-ext"),
) )
.arg( .arg(
Arg::with_name("crt-signature-alg")
Arg::new("crt-signature-alg")
.long("crt-signature-alg") .long("crt-signature-alg")
.help("The certificate's signature algorithm") .help("The certificate's signature algorithm")
.takes_value(true) .takes_value(true)
@ -135,7 +135,7 @@ fn main() {
.default_value(&default_crt_key_type), .default_value(&default_crt_key_type),
) )
.arg( .arg(
Arg::with_name("crt-digest")
Arg::new("crt-digest")
.long("crt-digest") .long("crt-digest")
.help("The certificate's digest algorithm") .help("The certificate's digest algorithm")
.takes_value(true) .takes_value(true)
@ -144,7 +144,7 @@ fn main() {
.default_value(&default_crt_digest), .default_value(&default_crt_digest),
) )
.arg( .arg(
Arg::with_name("log-level")
Arg::new("log-level")
.long("log-level") .long("log-level")
.help("Specify the log level") .help("Specify the log level")
.takes_value(true) .takes_value(true)
@ -153,25 +153,25 @@ fn main() {
.default_value(&default_log_level), .default_value(&default_log_level),
) )
.arg( .arg(
Arg::with_name("to-syslog")
Arg::new("to-syslog")
.long("log-syslog") .long("log-syslog")
.help("Sends log messages via syslog") .help("Sends log messages via syslog")
.conflicts_with("to-stderr"), .conflicts_with("to-stderr"),
) )
.arg( .arg(
Arg::with_name("to-stderr")
Arg::new("to-stderr")
.long("log-stderr") .long("log-stderr")
.help("Prints log messages to the standard error output") .help("Prints log messages to the standard error output")
.conflicts_with("to-syslog"), .conflicts_with("to-syslog"),
) )
.arg( .arg(
Arg::with_name("foreground")
Arg::new("foreground")
.long("foreground") .long("foreground")
.short("f")
.short('f')
.help("Runs in the foreground"), .help("Runs in the foreground"),
) )
.arg( .arg(
Arg::with_name("pid-file")
Arg::new("pid-file")
.long("pid-file") .long("pid-file")
.help("Path to the PID file") .help("Path to the PID file")
.takes_value(true) .takes_value(true)

Loading…
Cancel
Save