You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Day 20: CLI Arguments and Logging, a issue with the chapter #8
As mentioned in the section on Adding CLI Arguments
follow the steps and you will see the following output on the command line
cargo run -p cli -- --help
wasm-runner 0.1.0
Sample project from https://vino.dev/blog/node-to-rust-day-1-rustup/
USAGE:
cli
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
The example code at this point should look like this
use my_lib::Module;
use structopt::{clap::AppSettings, StructOpt};
#[macro_use]
extern crate log;
#[derive(StructOpt)]
#[structopt(
name = "wasm-runner",
about = "Sample project from https://vino.dev/blog/node-to-rust-day-1-rustup/",
global_settings(&[
AppSettings::ColoredHelp
]),
)]
struct CliOptions {}
fn main() {
env_logger::init();
debug!("Initialized logger");
match Module::from_file("./module.wasm") {
Ok(_) => {
info!("Module loaded");
}
Err(e) => {
error!("Module failed to load: {}", e);
}
}
}
Activity