Skip to content

Commit 271214a

Browse files
rw-vancIsaacWoods
authored andcommitted
Update aml_tester to clap 4
1 parent 14c6c67 commit 271214a

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

aml_tester/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ authors = ["Isaac Woods"]
55
edition = "2018"
66

77
[dependencies]
8-
clap = "2"
8+
clap = "4"
99
termion = "1"
1010
log = "0.4"
1111
aml = { path = "../aml" }

aml_tester/src/main.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111

1212
use aml::{AmlContext, DebugVerbosity};
13-
use clap::{App, Arg};
13+
use clap::{Arg, ArgAction};
1414
use std::{
1515
ffi::OsStr,
1616
fs::{self, File},
@@ -24,18 +24,18 @@ fn main() -> std::io::Result<()> {
2424
log::set_logger(&Logger).unwrap();
2525
log::set_max_level(log::LevelFilter::Trace);
2626

27-
let matches = App::new("aml_tester")
27+
let matches = clap::Command::new("aml_tester")
2828
.version("v0.1.0")
2929
.author("Isaac Woods")
3030
.about("Compiles and tests ASL files")
31-
.arg(Arg::with_name("path").short("p").long("path").required(true).takes_value(true))
32-
.arg(Arg::with_name("no_compile").long("no-compile"))
31+
.arg(Arg::new("path").short('p').long("path").required(true).action(ArgAction::Set).value_name("DIR"))
32+
.arg(Arg::new("no_compile").long("no-compile").action(ArgAction::SetTrue))
3333
.get_matches();
3434

35-
let dir_path = Path::new(matches.value_of("path").unwrap());
35+
let dir_path = Path::new(matches.get_one::<String>("path").unwrap());
3636
println!("Running tests in directory: {:?}", dir_path);
3737

38-
if !matches.is_present("no_compile") {
38+
if !matches.get_flag("no_compile") {
3939
let (passed, failed) = compile_asl_files(dir_path)?;
4040
println!("Compiled {} ASL files: {} passed, {} failed.", passed + failed, passed, failed);
4141
}

0 commit comments

Comments
 (0)