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

Refactoring the cli #11702

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 117 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ authors = [
ansi_term = "0.11"
atty = "0.2.8"
blooms-db = { path = "util/blooms-db" }
clap = "2"
clap = { git = "https://github.com/clap-rs/clap" }
cli-signer= { path = "cli-signer" }
client-traits = { path = "ethcore/client-traits" }
common-types = { path = "ethcore/types" }
Expand Down Expand Up @@ -78,6 +78,7 @@ spec = { path = "ethcore/spec" }
term_size = "0.3"
textwrap = "0.11.0"
toml = "0.5.6"
rust-embed = "5.5.1"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any strong reason not to use standard include family macros?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just found rust-embed to have a cleaner api. I believe internally, it expands to include macros

verification = { path = "ethcore/verification" }

[build-dependencies]
Expand Down
6 changes: 3 additions & 3 deletions ethcore/wasm/run/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ authors = ["Parity Technologies <[email protected]>"]
serde = "1"
serde_json = "1"
serde_derive = "1"
ethereum-types = "0.9.0"
ethereum-types = "0.9"
ethjson = { path = "../../../json" }
vm = { path = "../../vm" }
wasm = { path = "../" }
clap = "2.24"
env_logger = "0.5"
clap = { git = "https://github.com/clap-rs/clap" }
env_logger = "0.7"
rustc-hex = "2.1.0"

[features]
Expand Down
28 changes: 17 additions & 11 deletions ethcore/wasm/run/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,30 @@ mod fixture;
mod runner;

use fixture::Fixture;
use clap::{App, Arg};
use clap::Clap;
use std::fs;

#[derive(Clap)]
#[clap(
name = "pwasm-run-test",
)]
struct Options {
#[clap(
required = true,
name = "target",
min_values = 1,
about = "JSON fixture",
)]
pub target: Vec<String>
}

fn main() {
::env_logger::init();

let matches = App::new("pwasm-run-test")
.arg(Arg::with_name("target")
.index(1)
.required(true)
.multiple(true)
.help("JSON fixture"))
.get_matches();

let mut exit_code = 0;

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

for fixture in fixtures.into_iter() {
Expand Down
Loading