Skip to content

Commit

Permalink
Migrate structopt to clap
Browse files Browse the repository at this point in the history
Last usage of syn v1 removed.
  • Loading branch information
RReverser committed Jan 22, 2024
1 parent 4733bcf commit d6b9c2d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ libtest-mimic = "0.7.0"
wast = "70.0.0"
anyhow = { version = "1.0.79", features = ["backtrace"] }
tempfile = "3.9.0"
structopt = "0.3.26"
indexmap = { version = "2.1.0", features = ["rayon"] }
rayon = "1.8.0"
fs-err = "2.11.0"
clap = "4.4.18"

[[bench]]
name = "bench"
Expand Down
12 changes: 6 additions & 6 deletions examples/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
// limitations under the License.

use anyhow::Context;
use clap::{Parser, Subcommand};
use std::fs::File;
use std::io::{BufReader, Seek};
use structopt::StructOpt;
use wasmbin::io::DecodeError;
use wasmbin::sections::{Kind, Section};
use wasmbin::visit::{Visit, VisitError};
use wasmbin::Module;

#[derive(StructOpt)]
#[derive(Subcommand)]
enum DumpSection {
All,
Custom {
Expand All @@ -43,12 +43,12 @@ enum DumpSection {
Data,
}

#[derive(StructOpt)]
#[derive(Parser)]
struct DumpOpts {
filename: String,
#[structopt(long)]
#[arg(long)]
include_raw: bool,
#[structopt(flatten)]
#[command(subcommand)]
section: DumpSection,
}

Expand All @@ -68,7 +68,7 @@ fn unlazify_with_opt<T: Visit>(wasm: &mut T, include_raw: bool) -> Result<(), De
}

fn main() -> anyhow::Result<()> {
let opts = DumpOpts::from_args();
let opts = DumpOpts::parse();
let f = File::open(opts.filename)?;
let mut f = BufReader::new(f);
let mut m = Module::decode_from(&mut f).with_context(|| {
Expand Down

0 comments on commit d6b9c2d

Please sign in to comment.