From 0e063340572847c05481948ea864b7d1afd07e1e Mon Sep 17 00:00:00 2001 From: Jake Hillion Date: Wed, 4 May 2022 12:50:21 +0100 Subject: [PATCH] updated clap --- .vscode/settings.json | 3 ++- Cargo.lock | 26 ++++++++++++++++---------- src/main.rs | 40 ++++++++++++++++++++++++++++++++-------- 3 files changed, 50 insertions(+), 19 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 23fd35f..99fa10c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,4 @@ { - "editor.formatOnSave": true + "editor.formatOnSave": true, + "rust.clippy_preference": "on" } \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index ed61c66..f8ab7e1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -86,24 +86,33 @@ dependencies = [ [[package]] name = "clap" -version = "3.0.14" +version = "3.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b63edc3f163b3c71ec8aa23f9bd6070f77edbf3d1d198b164afa90ff00e4ec62" +checksum = "85a35a599b11c089a7f49105658d089b8f2cf0882993c17daf6de15285c2c35d" dependencies = [ "atty", "bitflags", + "clap_lex", "indexmap", - "os_str_bytes", "strsim", "termcolor", - "textwrap 0.14.2", + "textwrap 0.15.0", +] + +[[package]] +name = "clap_lex" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a37c35f1112dad5e6e0b1adaff798507497a18fceeb30cceb3bae7d1427b9213" +dependencies = [ + "os_str_bytes", ] [[package]] name = "clone-shim" version = "0.1.0" dependencies = [ - "clap 3.0.14", + "clap 3.1.15", "close_fds", "criterion", "env_logger", @@ -429,9 +438,6 @@ name = "os_str_bytes" version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" -dependencies = [ - "memchr", -] [[package]] name = "plotters" @@ -673,9 +679,9 @@ dependencies = [ [[package]] name = "textwrap" -version = "0.14.2" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80" +checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" [[package]] name = "thiserror" diff --git a/src/main.rs b/src/main.rs index 06f8f7f..f6c0b92 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,19 +4,43 @@ use clone_shim::{run, RunArgs}; use std::path::Path; -use clap::{App, AppSettings}; +use clap::{Arg, Command}; fn main() { // process arguments - let matches = App::new("clone-shim") + let matches = Command::new("clone-shim") .version(env!("GIT_HASH")) .author("Jake Hillion ") - .about("Launch a multi entrypoint app, cloning as requested by an external specification or the ELF.") - .arg(clap::Arg::new("spec").long("specification").short('s').help("Provide the specification as an external JSON file.").takes_value(true)) - .setting(AppSettings::TrailingVarArg) - .arg(clap::Arg::new("verbose").long("verbose").short('v').help("Use verbose logging.").takes_value(false)) - .arg(clap::Arg::new("debug").long("debug").short('d').help("Stop each spawned application process so that it can be attached to.").takes_value(false)) - .arg(clap::Arg::new("binary").index(1).help("Binary and arguments to launch with the shim").required(true).multiple_values(true)) + .about("Launch a void process application.") + .trailing_var_arg(true) + .arg( + Arg::new("spec") + .long("specification") + .short('s') + .help("Provide the specification as an external JSON file.") + .takes_value(true), + ) + .arg( + Arg::new("verbose") + .long("verbose") + .short('v') + .help("Use verbose logging.") + .takes_value(false), + ) + .arg( + Arg::new("debug") + .long("debug") + .short('d') + .help("Stop each spawned application process so that it can be attached to.") + .takes_value(false), + ) + .arg( + Arg::new("binary") + .index(1) + .help("Binary and arguments to launch with the shim") + .required(true) + .multiple_values(true), + ) .get_matches(); // setup logging