From 3075be62ac357432241b427233b1235fbb2a02a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sarek=20H=C3=B8verstad=20Skot=C3=A5m?= Date: Thu, 11 Apr 2024 00:19:40 +0200 Subject: [PATCH] Update Clap --- Cargo.lock | 87 +++----------------------------------------- CreuSAT/Cargo.toml | 3 +- CreuSAT/src/main.rs | 20 +++------- Friday/Cargo.toml | 1 - JigSAT/Cargo.toml | 2 +- JigSAT/src/main.rs | 22 ++++------- Robinson/Cargo.toml | 2 +- Robinson/src/main.rs | 20 +++------- Scratch/Cargo.toml | 2 +- 9 files changed, 28 insertions(+), 131 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 95604afd..572a4db1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6,7 +6,7 @@ version = 3 name = "CreuSAT" version = "0.1.0" dependencies = [ - "clap 2.34.0", + "clap", "creusot-contracts", "rand", "termcolor", @@ -32,7 +32,7 @@ dependencies = [ name = "JigSAT" version = "0.1.0" dependencies = [ - "clap 2.34.0", + "clap", "log", "rand", "termcolor", @@ -49,7 +49,7 @@ dependencies = [ name = "Robinson" version = "0.1.0" dependencies = [ - "clap 2.34.0", + "clap", "creusot-contracts", ] @@ -57,19 +57,10 @@ dependencies = [ name = "Scratch" version = "0.1.0" dependencies = [ - "clap 4.5.4", + "clap", "creusot-contracts", ] -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - [[package]] name = "anstream" version = "0.6.13" @@ -118,50 +109,18 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "clap" -version = "2.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" -dependencies = [ - "ansi_term", - "atty", - "bitflags", - "strsim 0.8.0", - "textwrap", - "unicode-width", - "vec_map", -] - [[package]] name = "clap" version = "4.5.4" @@ -180,7 +139,7 @@ dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim 0.11.1", + "strsim", ] [[package]] @@ -236,15 +195,6 @@ dependencies = [ "wasi", ] -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "libc" version = "0.2.153" @@ -362,12 +312,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - [[package]] name = "strsim" version = "0.11.1" @@ -394,27 +338,12 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" -[[package]] -name = "unicode-width" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" - [[package]] name = "utf8parse" version = "0.2.1" @@ -430,12 +359,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" diff --git a/CreuSAT/Cargo.toml b/CreuSAT/Cargo.toml index c6b55917..c33357c6 100644 --- a/CreuSAT/Cargo.toml +++ b/CreuSAT/Cargo.toml @@ -5,8 +5,7 @@ authors = ["Sarek Høverstad Skotåm "] edition = "2021" [dependencies] -#clap = "4.0.18" -clap = "2.33.3" +clap = "4.5" rand = "*" creusot-contracts = { git = "https://github.com/xldenis/creusot", version = "^0", rev = "1357cc97" } diff --git a/CreuSAT/src/main.rs b/CreuSAT/src/main.rs index d32caa95..90c8963c 100644 --- a/CreuSAT/src/main.rs +++ b/CreuSAT/src/main.rs @@ -1,4 +1,4 @@ -use clap::{crate_authors, App, AppSettings, Arg}; +use clap::{arg, crate_authors, Command}; #[cfg(creusot)] fn main() {} @@ -6,22 +6,14 @@ fn main() {} #[cfg(not(creusot))] fn main() { use CreuSAT::parser::{parse_cnf, preproc_and_solve}; - let matches = App::new("\nCreuSAT") + let matches = Command::new("\nCreuSAT") .author(crate_authors!("\n")) .about("A verified SAT solver written in Rust.") - .usage("cargo run -- [FLAGS] --file ") - .setting(AppSettings::ColoredHelp) - .setting(AppSettings::DisableVersion) - .arg( - Arg::with_name("file") - .short("f") - .long("file") - .takes_value(true) - .required(true) - .help("CNF file to be parsed"), - ) + .disable_colored_help(false) + .disable_version_flag(true) + .arg(arg!(-f --file ).long("file").required(true).help("CNF file to be parsed")) .get_matches(); - let filename = matches.value_of("file").unwrap(); + let filename = matches.get_one::("file").unwrap(); println!("c Reading file '{}'", filename); let res = parse_cnf(filename); match res { diff --git a/Friday/Cargo.toml b/Friday/Cargo.toml index af5a60e6..ae8b2932 100644 --- a/Friday/Cargo.toml +++ b/Friday/Cargo.toml @@ -6,7 +6,6 @@ edition = "2021" [dependencies] -#clap = "2.33.3" creusot-contracts = { git = "https://github.com/xldenis/creusot", version = "^0", rev = "1357cc97" } [features] diff --git a/JigSAT/Cargo.toml b/JigSAT/Cargo.toml index d3f0655b..6fc8c157 100644 --- a/JigSAT/Cargo.toml +++ b/JigSAT/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Sarek Høverstad Skotåm "] edition = "2021" [dependencies] -clap = "2.33.3" +clap = "4.5" log = "0.4" rand = "0.8.5" diff --git a/JigSAT/src/main.rs b/JigSAT/src/main.rs index 20f90d19..d6f4a275 100644 --- a/JigSAT/src/main.rs +++ b/JigSAT/src/main.rs @@ -1,23 +1,15 @@ -use clap::{crate_authors, App, AppSettings, Arg}; +use clap::{arg, crate_authors, Command}; fn main() { use JigSAT::parser::{parse_cnf, preproc_and_solve}; - let matches = App::new("\nJigSAT") + let matches = Command::new("\nJigSAT") .author(crate_authors!("\n")) - .about("A non-verified SAT solver which acts as a playground for CreuSAT.") - .usage("cargo run -- [FLAGS] --file ") - .setting(AppSettings::ColoredHelp) - .setting(AppSettings::DisableVersion) - .arg( - Arg::with_name("file") - .short("f") - .long("file") - .takes_value(true) - .required(true) - .help("CNF file to be parsed"), - ) + .about("An unverified SAT solver which acts as a playground for CreuSAT.") + .disable_colored_help(false) + .disable_version_flag(true) + .arg(arg!(-f --file ).long("file").required(true).help("CNF file to be parsed")) .get_matches(); - let filename = matches.value_of("file").unwrap(); + let filename = matches.get_one::("file").unwrap(); println!("c Reading file '{}'", filename); let res = parse_cnf(filename); match res { diff --git a/Robinson/Cargo.toml b/Robinson/Cargo.toml index b62a745f..103f5f26 100644 --- a/Robinson/Cargo.toml +++ b/Robinson/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Sarek Høverstad Skotåm "] edition = "2021" [dependencies] -clap = "2.33.3" +clap = { version = "4.5", features = ["cargo"] } creusot-contracts = { git = "https://github.com/xldenis/creusot", version = "^0", rev = "1357cc97" } # This is just copied verbatim from CreuSAT. diff --git a/Robinson/src/main.rs b/Robinson/src/main.rs index 5a2b2de0..3e0c569d 100644 --- a/Robinson/src/main.rs +++ b/Robinson/src/main.rs @@ -6,24 +6,16 @@ fn main() {} #[cfg(not(creusot))] fn main() { - use clap::{crate_authors, App, AppSettings, Arg}; + use clap::{arg, crate_authors, Command}; use Robinson::parser::{parse_cnf, preproc_and_solve}; - let matches = App::new("\nRobinson") + let matches = Command::new("\nRobinson") .author(crate_authors!("\n")) .about("A verified DPLL-based SAT solver written in Rust.") - .usage("cargo run -- [FLAGS] --file ") - .setting(AppSettings::ColoredHelp) - .setting(AppSettings::DisableVersion) - .arg( - Arg::with_name("file") - .short("f") - .long("file") - .takes_value(true) - .required(true) - .help("CNF file to be parsed"), - ) + .disable_colored_help(false) + .disable_version_flag(true) + .arg(arg!(-f --file ).long("file").required(true).help("CNF file to be parsed")) .get_matches(); - let filename = matches.value_of("file").unwrap(); + let filename = matches.get_one::("file").unwrap(); println!("c Reading file '{}'", filename); let res = parse_cnf(filename); match res { diff --git a/Scratch/Cargo.toml b/Scratch/Cargo.toml index 5398e5f1..ee9a9e97 100644 --- a/Scratch/Cargo.toml +++ b/Scratch/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Sarek Høverstad Skotåm "] edition = "2021" [dependencies] -clap = "4.5.4" +clap = "4.5" creusot-contracts = { git = "https://github.com/xldenis/creusot", version = "^0", rev = "1357cc97" } # This is just copied verbatim from CreuSAT.