Drops-of-Diamond / diamond_drops

WIP on sharding and Ethereum 2.0 with enshrined-in-consensus data availability and Rust: a fast, safe, concurrent and practical programming language
The Unlicense
57 stars 14 forks source link

feat: Fixes #39. Integrates Clap CLI with Help menu. Update all tests passing #49

Closed ltfschoen closed 6 years ago

ltfschoen commented 6 years ago

We've not integrated Clap into the CLI, which includes an in-built Help menu for Commands (i.e. Log, which is optional) cargo run -- --log 4 and Sub-Commands (i.e. Mode, which may be used in conjunction with a Command). We can use Cargo Make to conveniently check everything is working still in the Main Package and all Libraries with:

We can see the Help menu for all Commands with: cargo run -- help We can see the Help menu for the "mode" SubCommand with: cargo run -- mode --help

Below are different combinations you can use, which the Help menu's will explain anyway:

cargo run -- help
cargo run -- --help
cargo run -- mode --help
cargo run -- --log 4 
cargo run -- --log 4 mode --help
cargo run -- --log 4 mode --proposer
cargo run -- --log 4 mode --notary
cargo run -- --log 4 mode --both
cargo run -- -l 4 mode -p
cargo run -- -l 4 mode -n
cargo run -- -l 4 mode -b

The last three commands above are equivalent to the following three commands respectively:

cargo run --bin cli -- -l 4 mode -p
cargo run --bin cli -- -l 4 mode -n
cargo run --bin cli -- -l 4 mode -b
jamesray1 commented 6 years ago

I expect that we will merge our work into Parity eventually, so could you look into how we would add our work with their CLI? I don't want us to spend a lot of time on changes that will need to be substantially reworked to fit with Parity, useful though they may be in the mean time. I'm not saying that your reorganization can't be. Maybe @NikVolf, @folsen or @debris can advise?

folsen commented 6 years ago

We aim to make our CLI bits a thin wrapper completely separate and outside the parity "library", and thus any CLI stuff should be pretty manageable. I'd recommend that you have your own CLI for now so as not to have to deal with all the legacy, and then when/if time comes to merge things, we just take what your CLI has and put that into ours. The most important thing is that your code would be similarly structured in a CLI bit and a library bit that the CLI code "calls into".

jamesray1 commented 6 years ago

OK, thanks Fredrik! We have a separate folder and crate for the CLI which uses Clap, although it doesn't call into other crates in our repo yet.