diff --git a/Cargo.lock b/Cargo.lock index 5946d97..f4ed48c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -125,24 +125,22 @@ dependencies = [ [[package]] name = "clap" -version = "3.2.22" +version = "4.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86447ad904c7fb335a790c9d7fe3d0d971dc523b8ccd1561a520de9a85302750" +checksum = "5840cd9093aabeabf7fd932754c435b7674520fc3ddc935c397837050f0f1e4b" dependencies = [ "atty", "bitflags", "clap_lex", - "indexmap", "strsim", "termcolor", - "textwrap", ] [[package]] name = "clap_lex" -version = "0.2.4" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8" dependencies = [ "os_str_bytes", ] @@ -303,12 +301,6 @@ dependencies = [ "slab", ] -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - [[package]] name = "heck" version = "0.4.0" @@ -324,16 +316,6 @@ dependencies = [ "libc", ] -[[package]] -name = "indexmap" -version = "1.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" -dependencies = [ - "autocfg", - "hashbrown", -] - [[package]] name = "libc" version = "0.2.134" @@ -699,12 +681,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "textwrap" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "949517c0cf1bf4ee812e2e07e08ab448e3ae0d23472aee8a06c985f0c8815b16" - [[package]] name = "tock-registers" version = "0.8.1" diff --git a/bin/chainofcommand/Cargo.toml b/bin/chainofcommand/Cargo.toml index 80357da..4cc0ec9 100644 --- a/bin/chainofcommand/Cargo.toml +++ b/bin/chainofcommand/Cargo.toml @@ -12,7 +12,7 @@ edition = "2021" maintenance = { status = "experimental" } [dependencies] -clap = "3.2" +clap = "4.0.0" seahash = "4.1" anyhow = "1.0" fehler = "1.0" diff --git a/bin/chainofcommand/src/main.rs b/bin/chainofcommand/src/main.rs index adfc435..0f2e054 100644 --- a/bin/chainofcommand/src/main.rs +++ b/bin/chainofcommand/src/main.rs @@ -3,7 +3,7 @@ use { anyhow::{anyhow, Result}, bytes::Bytes, - clap::{Arg, Command}, + clap::{value_parser, Arg, ArgAction, Command}, crossterm::{ cursor, event::{Event, EventStream, KeyCode, KeyEvent, KeyModifiers}, @@ -324,19 +324,27 @@ async fn main() -> Result<()> { Arg::new("baud") .help("The baud rate to connect at") .use_value_delimiter(false) + .action(ArgAction::Set) + .value_parser(value_parser!(u32)) .required(true), // .validator(valid_baud), ) .arg( Arg::new("kernel") .long("kernel") .help("Path of the binary kernel image to send") - .takes_value(true) .default_value("kernel8.img"), ) .get_matches(); - let port_name = matches.value_of("port").unwrap(); - let baud_rate = matches.value_of("baud").unwrap().parse::<u32>().unwrap(); - let kernel = matches.value_of("kernel").unwrap().to_owned(); + let port_name = matches + .get_one::<String>("port") + .expect("port must be specified"); + let baud_rate = matches + .get_one("baud") + .copied() + .expect("baud rate must be an integer"); + let kernel = matches + .get_one::<String>("kernel") + .expect("kernel file must be specified"); // Check that STDIN is a proper tty if !std::io::stdin().is_tty() {