Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

Commit 34658ec

Browse files
committed
Port to Clap 3.0
1 parent 5b99a53 commit 34658ec

12 files changed

+1965
-1724
lines changed

Cargo.lock

+44-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ authors = [
1313
ansi_term = "0.11"
1414
atty = "0.2.8"
1515
blooms-db = { path = "util/blooms-db" }
16-
clap = "2"
16+
clap = { git = "https://github.com/clap-rs/clap" }
1717
cli-signer= { path = "cli-signer" }
1818
client-traits = { path = "ethcore/client-traits" }
1919
common-types = { path = "ethcore/types" }
@@ -75,7 +75,6 @@ serde_derive = "1.0"
7575
serde_json = "1.0"
7676
snapshot = { path = "ethcore/snapshot" }
7777
spec = { path = "ethcore/spec" }
78-
structopt = "~0.3"
7978
term_size = "0.3"
8079
textwrap = "0.11.0"
8180
toml = "0.5.6"

ethcore/wasm/run/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ authors = ["Parity Technologies <[email protected]>"]
88
serde = "1"
99
serde_json = "1"
1010
serde_derive = "1"
11-
ethereum-types = "0.9.0"
11+
ethereum-types = "0.9"
1212
ethjson = { path = "../../../json" }
1313
vm = { path = "../../vm" }
1414
wasm = { path = "../" }
15-
clap = "2.24"
16-
env_logger = "0.5"
15+
clap = { git = "https://github.com/clap-rs/clap" }
16+
env_logger = "0.7"
1717
rustc-hex = "2.1.0"
1818

1919
[features]

ethcore/wasm/run/src/main.rs

+17-11
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,30 @@ mod fixture;
2929
mod runner;
3030

3131
use fixture::Fixture;
32-
use clap::{App, Arg};
32+
use clap::Clap;
3333
use std::fs;
3434

35+
#[derive(Clap)]
36+
#[clap(
37+
name = "pwasm-run-test",
38+
)]
39+
struct Options {
40+
#[clap(
41+
required = true,
42+
name = "target",
43+
min_values = 1,
44+
about = "JSON fixture",
45+
)]
46+
pub target: Vec<String>
47+
}
48+
3549
fn main() {
3650
::env_logger::init();
3751

38-
let matches = App::new("pwasm-run-test")
39-
.arg(Arg::with_name("target")
40-
.index(1)
41-
.required(true)
42-
.multiple(true)
43-
.help("JSON fixture"))
44-
.get_matches();
45-
4652
let mut exit_code = 0;
4753

48-
for target in matches.values_of("target").expect("No target parameter") {
49-
let mut f = fs::File::open(target).expect("Failed to open file");
54+
for target in Options::parse().target {
55+
let mut f = fs::File::open(&target).expect("Failed to open file");
5056
let fixtures: Vec<Fixture> = serde_json::from_reader(&mut f).expect("Failed to deserialize json");
5157

5258
for fixture in fixtures.into_iter() {

parity/cli/args.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
use clap::Clap;
12
use cli::config::get_config;
23
use cli::globals::{Globals, IPCOptions};
34
use cli::parse_cli::*;
45
use cli::subcommands::*;
56
use std::fs;
6-
use structopt::StructOpt;
77

88
#[derive(Debug, PartialEq)]
99
pub enum ArgsError {
@@ -216,8 +216,6 @@ pub struct Args {
216216
pub arg_max_round_blocks_to_import: usize,
217217
pub flag_can_restart: bool,
218218
pub flag_no_color: bool,
219-
// NOTE: This is auto handled by structopt
220-
// pub flag_version: bool,
221219
pub flag_no_config: bool,
222220
pub arg_logging: Option<String>,
223221
pub arg_log_file: Option<String>,
@@ -247,7 +245,7 @@ impl Args {
247245
pub fn parse() -> Result<Self, ArgsError> {
248246
let mut args: Args = Default::default();
249247

250-
let mut raw_input = ArgsInput::from_args();
248+
let mut raw_input = ArgsInput::parse();
251249

252250
Args::save_current_config(&mut raw_input.globals)?;
253251

0 commit comments

Comments
 (0)