From f5b73f842e2edb2148123311f1270dda7e3987f2 Mon Sep 17 00:00:00 2001 From: Tpt Date: Thu, 29 Sep 2022 10:45:26 +0200 Subject: [PATCH] Upgrades clap to v4 --- Cargo.lock | 36 +++++++++++++++++++++++++++++------- server/Cargo.toml | 2 +- server/src/main.rs | 14 +++++++------- testsuite/Cargo.toml | 2 +- 4 files changed, 38 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8d053625..c1b77098 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -173,20 +173,33 @@ checksum = "86447ad904c7fb335a790c9d7fe3d0d971dc523b8ccd1561a520de9a85302750" dependencies = [ "atty", "bitflags", - "clap_derive", - "clap_lex", + "clap_lex 0.2.4", "indexmap", - "once_cell", "strsim", "termcolor", "textwrap 0.15.1", ] +[[package]] +name = "clap" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31c9484ccdc4cb8e7b117cbd0eb150c7c0f04464854e4679aeb50ef03b32d003" +dependencies = [ + "atty", + "bitflags", + "clap_derive", + "clap_lex 0.3.0", + "once_cell", + "strsim", + "termcolor", +] + [[package]] name = "clap_derive" -version = "3.2.18" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65" +checksum = "ca689d7434ce44517a12a89456b2be4d1ea1cafcd8f581978c03d45f5a5c12a7" dependencies = [ "heck", "proc-macro-error", @@ -204,6 +217,15 @@ dependencies = [ "os_str_bytes", ] +[[package]] +name = "clap_lex" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8" +dependencies = [ + "os_str_bytes", +] + [[package]] name = "console_error_panic_hook" version = "0.1.7" @@ -809,7 +831,7 @@ dependencies = [ name = "oxigraph_server" version = "0.3.6" dependencies = [ - "clap 3.2.22", + "clap 4.0.2", "flate2", "oxhttp", "oxigraph", @@ -825,7 +847,7 @@ name = "oxigraph_testsuite" version = "0.3.6" dependencies = [ "anyhow", - "clap 3.2.22", + "clap 4.0.2", "criterion", "oxigraph", "text-diff", diff --git a/server/Cargo.toml b/server/Cargo.toml index 1a3f34e6..224ef5c1 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -13,7 +13,7 @@ edition = "2021" [dependencies] oxhttp = { version = "0.1", features = ["rayon"] } -clap = { version = "3", features = ["derive"] } +clap = { version = "4", features = ["derive"] } oxigraph = { version = "0.3.6", path = "../lib", features = ["http_client"] } sparesults = { version = "0.1.1", path = "../lib/sparesults", features = ["rdf-star"] } rand = "0.8" diff --git a/server/src/main.rs b/server/src/main.rs index 131c50f7..0edccbf3 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -28,13 +28,13 @@ const HTML_ROOT_PAGE: &str = include_str!("../templates/query.html"); const LOGO: &str = include_str!("../logo.svg"); #[derive(Parser)] -#[clap(about, version)] +#[command(about, version)] /// Oxigraph SPARQL server. struct Args { /// Directory in which persist the data. - #[clap(short, long, parse(from_os_str), global = true)] + #[arg(short, long, global = true)] location: Option, - #[clap(subcommand)] + #[command(subcommand)] command: Command, } @@ -43,7 +43,7 @@ enum Command { /// Start Oxigraph HTTP server. Serve { /// Host and port to listen to. - #[clap(short, long, default_value = "localhost:7878", global = true)] + #[arg(short, long, default_value = "localhost:7878", global = true)] bind: String, }, /// Load file(s) into the store. @@ -51,12 +51,12 @@ enum Command { /// file(s) to load. /// /// If multiple files are provided they are loaded in parallel. - #[clap(short, long, global = true, multiple_values = true)] + #[arg(short, long, global = true, num_args = 0..)] file: Vec, /// Attempt to keep loading even if the data file is invalid. /// /// Only works with N-Triples and N-Quads for now. - #[clap(long, global = true)] + #[arg(long, global = true)] lenient: bool, }, } @@ -1687,7 +1687,7 @@ mod tests { #[test] fn clap_debug() { - use clap::IntoApp; + use clap::CommandFactory; Args::command().debug_assert() } diff --git a/testsuite/Cargo.toml b/testsuite/Cargo.toml index 747ebcee..d05bdd95 100644 --- a/testsuite/Cargo.toml +++ b/testsuite/Cargo.toml @@ -13,7 +13,7 @@ publish = false [dependencies] anyhow = "1" -clap = { version = "3", features = ["derive"] } +clap = { version = "4", features = ["derive"] } time = { version = "0.3", features = ["formatting"] } oxigraph = { version = "0.3.6", path="../lib" } text-diff = "0.4"