Skip to content

Commit

Permalink
Update Clap
Browse files Browse the repository at this point in the history
  • Loading branch information
sarsko committed Apr 10, 2024
1 parent a8b3b92 commit 3075be6
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 131 deletions.
87 changes: 5 additions & 82 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions CreuSAT/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ authors = ["Sarek Høverstad Skotåm <sarek.skotam@gmail.com>"]
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" }

Expand Down
20 changes: 6 additions & 14 deletions CreuSAT/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
use clap::{crate_authors, App, AppSettings, Arg};
use clap::{arg, crate_authors, Command};

#[cfg(creusot)]
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 <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 <FILENAME>).long("file").required(true).help("CNF file to be parsed"))
.get_matches();
let filename = matches.value_of("file").unwrap();
let filename = matches.get_one::<String>("file").unwrap();
println!("c Reading file '{}'", filename);
let res = parse_cnf(filename);
match res {
Expand Down
1 change: 0 additions & 1 deletion Friday/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ edition = "2021"


[dependencies]
#clap = "2.33.3"
creusot-contracts = { git = "https://github.com/xldenis/creusot", version = "^0", rev = "1357cc97" }

[features]
Expand Down
2 changes: 1 addition & 1 deletion JigSAT/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Sarek Høverstad Skotåm <sarek.skotam@gmail.com>"]
edition = "2021"

[dependencies]
clap = "2.33.3"
clap = "4.5"
log = "0.4"
rand = "0.8.5"

Expand Down
22 changes: 7 additions & 15 deletions JigSAT/src/main.rs
Original file line number Diff line number Diff line change
@@ -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 <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 <FILENAME>).long("file").required(true).help("CNF file to be parsed"))
.get_matches();
let filename = matches.value_of("file").unwrap();
let filename = matches.get_one::<String>("file").unwrap();
println!("c Reading file '{}'", filename);
let res = parse_cnf(filename);
match res {
Expand Down
2 changes: 1 addition & 1 deletion Robinson/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Sarek Høverstad Skotåm <sarek.skotam@gmail.com>"]
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.
Expand Down
20 changes: 6 additions & 14 deletions Robinson/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 <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 <FILENAME>).long("file").required(true).help("CNF file to be parsed"))
.get_matches();
let filename = matches.value_of("file").unwrap();
let filename = matches.get_one::<String>("file").unwrap();
println!("c Reading file '{}'", filename);
let res = parse_cnf(filename);
match res {
Expand Down
2 changes: 1 addition & 1 deletion Scratch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Sarek Høverstad Skotåm <sarek.skotam@gmail.com>"]
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.
Expand Down

0 comments on commit 3075be6

Please sign in to comment.