Skip to content

Commit

Permalink
Migrate from structopt to clap
Browse files Browse the repository at this point in the history
Structopt is no longer maintained and its functionality has been merged
into clap-v3. Migrating to the latter means that som-rs will no longer
fail with the cargo security audit tool [1].

[1]: https://crates.io/crates/cargo-audit
  • Loading branch information
jacob-hughes authored and Hirevo committed May 7, 2024
1 parent 06dbd7a commit 35b780c
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 86 deletions.
135 changes: 63 additions & 72 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion som-interpreter-ast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ som-parser = { package = "som-parser-symbols", path = "../som-parser-symbols", v
# som-parser = { package = "som-parser-text", path = "../som-parser-text", version = "0.1.0" }

# CLI interface
structopt = "0.3.25"
clap = { version = "3.0", features = ["derive"] }

# error handling
anyhow = "1.0.51"
Expand Down
12 changes: 6 additions & 6 deletions som-interpreter-ast/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use std::path::PathBuf;
use std::rc::Rc;

use anyhow::anyhow;
use clap::Parser;
#[cfg(feature = "jemalloc")]
use jemallocator::Jemalloc;
use structopt::StructOpt;

mod shell;

Expand All @@ -21,22 +21,22 @@ use som_interpreter_ast::value::Value;
#[global_allocator]
static GLOBAL: Jemalloc = Jemalloc;

#[derive(Debug, Clone, PartialEq, StructOpt)]
#[derive(Debug, Clone, PartialEq, clap::StructOpt)]
#[structopt(about, author)]
struct Options {
/// Files to evaluate.
#[structopt(name = "FILE")]
#[clap(name = "FILE")]
file: Option<PathBuf>,

#[structopt(name = "ARGS")]
#[clap(name = "ARGS")]
args: Vec<String>,

/// Set search path for application classes.
#[structopt(short, long)]
#[clap(short, long, multiple_values(true))]
classpath: Vec<PathBuf>,

/// Enable verbose output (with timing information).
#[structopt(short = "v")]
#[clap(short = 'v')]
verbose: bool,
}

Expand Down
2 changes: 1 addition & 1 deletion som-interpreter-bc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ som-parser = { package = "som-parser-symbols", path = "../som-parser-symbols", v
# som-parser = { package = "som-parser-text", path = "../som-parser-text", version = "0.1.0" }

# CLI interface
structopt = "0.3.25"
clap = { version = "3.0", features = ["derive"] }

# error handling
anyhow = "1.0.51"
Expand Down
12 changes: 6 additions & 6 deletions som-interpreter-bc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use std::path::PathBuf;
use std::rc::Rc;

use anyhow::{bail, Context};
use clap::Parser;
#[cfg(feature = "jemalloc")]
use jemallocator::Jemalloc;
use structopt::StructOpt;

mod shell;

Expand All @@ -23,8 +23,8 @@ use som_interpreter_bc::value::Value;
#[global_allocator]
static GLOBAL: Jemalloc = Jemalloc;

#[derive(Debug, Clone, PartialEq, StructOpt)]
#[structopt(about, author)]
#[derive(Debug, Clone, PartialEq, clap::StructOpt)]
#[clap(about, author)]
struct Options {
/// File to evaluate.
file: Option<PathBuf>,
Expand All @@ -33,15 +33,15 @@ struct Options {
args: Vec<String>,

/// Set search path for application classes.
#[structopt(long, short)]
#[clap(long, short, multiple_values(true))]
classpath: Vec<PathBuf>,

/// Disassemble the class, instead of executing.
#[structopt(long, short)]
#[clap(long, short)]
disassemble: bool,

/// Enable verbose output (with timing information).
#[structopt(short = "v")]
#[clap(short = 'v')]
verbose: bool,
}

Expand Down

0 comments on commit 35b780c

Please sign in to comment.