updated clap
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing

This commit is contained in:
Jake Hillion 2022-05-04 12:50:21 +01:00
parent de1ab423d1
commit 0e06334057
3 changed files with 50 additions and 19 deletions

View File

@ -1,3 +1,4 @@
{ {
"editor.formatOnSave": true "editor.formatOnSave": true,
"rust.clippy_preference": "on"
} }

26
Cargo.lock generated
View File

@ -86,24 +86,33 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "3.0.14" version = "3.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b63edc3f163b3c71ec8aa23f9bd6070f77edbf3d1d198b164afa90ff00e4ec62" checksum = "85a35a599b11c089a7f49105658d089b8f2cf0882993c17daf6de15285c2c35d"
dependencies = [ dependencies = [
"atty", "atty",
"bitflags", "bitflags",
"clap_lex",
"indexmap", "indexmap",
"os_str_bytes",
"strsim", "strsim",
"termcolor", "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]] [[package]]
name = "clone-shim" name = "clone-shim"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"clap 3.0.14", "clap 3.1.15",
"close_fds", "close_fds",
"criterion", "criterion",
"env_logger", "env_logger",
@ -429,9 +438,6 @@ name = "os_str_bytes"
version = "6.0.0" version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
dependencies = [
"memchr",
]
[[package]] [[package]]
name = "plotters" name = "plotters"
@ -673,9 +679,9 @@ dependencies = [
[[package]] [[package]]
name = "textwrap" name = "textwrap"
version = "0.14.2" version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80" checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
[[package]] [[package]]
name = "thiserror" name = "thiserror"

View File

@ -4,19 +4,43 @@ use clone_shim::{run, RunArgs};
use std::path::Path; use std::path::Path;
use clap::{App, AppSettings}; use clap::{Arg, Command};
fn main() { fn main() {
// process arguments // process arguments
let matches = App::new("clone-shim") let matches = Command::new("clone-shim")
.version(env!("GIT_HASH")) .version(env!("GIT_HASH"))
.author("Jake Hillion <jake@hillion.co.uk>") .author("Jake Hillion <jake@hillion.co.uk>")
.about("Launch a multi entrypoint app, cloning as requested by an external specification or the ELF.") .about("Launch a void process application.")
.arg(clap::Arg::new("spec").long("specification").short('s').help("Provide the specification as an external JSON file.").takes_value(true)) .trailing_var_arg(true)
.setting(AppSettings::TrailingVarArg) .arg(
.arg(clap::Arg::new("verbose").long("verbose").short('v').help("Use verbose logging.").takes_value(false)) Arg::new("spec")
.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)) .long("specification")
.arg(clap::Arg::new("binary").index(1).help("Binary and arguments to launch with the shim").required(true).multiple_values(true)) .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(); .get_matches();
// setup logging // setup logging