replace deprecated structopt crate with clap (#33)

Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
Cyrill Leutwiler
2024-08-23 18:25:08 +02:00
committed by GitHub
parent bb4a4dddde
commit 880305dbfb
4 changed files with 254 additions and 279 deletions
Generated
+246 -271
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -25,7 +25,7 @@ thiserror = "1.0"
which = "5.0"
path-slash = "0.2"
rayon = "1.8"
structopt = { version = "0.3", default-features = false }
clap = { version = "4", default-features = false, features = ["derive"] }
rand = "0.8"
polkavm-common = { git = "https://github.com/koute/polkavm.git", rev = "360029e" }
polkavm-linker = { git = "https://github.com/koute/polkavm.git", rev = "360029e" }
+1 -1
View File
@@ -17,7 +17,7 @@ path = "src/resolc/main.rs"
doctest = false
[dependencies]
structopt = { workspace = true }
clap = { workspace = true }
colored = { workspace = true }
thiserror = { workspace = true }
anyhow = { workspace = true }
+6 -6
View File
@@ -4,15 +4,15 @@ use std::collections::BTreeSet;
use std::path::Path;
use std::path::PathBuf;
use clap::Parser;
use path_slash::PathExt;
use structopt::StructOpt;
/// Compiles the provided Solidity input files (or use the standard input if no files
/// are given or "-" is specified as a file name). Outputs the components based on the
/// chosen options, either to the standard output or to files within the designated
/// output directory.
/// Example: resolc ERC20.sol -O3 --bin --output-dir './build/'
#[derive(Debug, StructOpt)]
#[derive(Debug, Parser)]
#[structopt(name = "The PolkaVM Solidity compiler")]
pub struct Arguments {
/// Print the version and exit.
@@ -42,7 +42,7 @@ pub struct Arguments {
pub allow_paths: Option<String>,
/// Create one file per component and contract/file at the specified directory, if given.
#[structopt(short = "o", long = "output-dir")]
#[structopt(short = 'o', long = "output-dir")]
pub output_directory: Option<PathBuf>,
/// Overwrite existing files (used together with -o).
@@ -51,7 +51,7 @@ pub struct Arguments {
/// Set the optimization parameter -O[0 | 1 | 2 | 3 | s | z].
/// Use `3` for best performance and `z` for minimal size.
#[structopt(short = "O", long = "optimization")]
#[structopt(short = 'O', long = "optimization")]
pub optimization: Option<char>,
/// Try to recompile with -Oz if the bytecode is too large.
@@ -81,7 +81,7 @@ pub struct Arguments {
/// Specify addresses of deployable libraries. Syntax: `<libraryName>=<address> [, or whitespace] ...`.
/// Addresses are interpreted as hexadecimal strings prefixed with `0x`.
#[structopt(short = "l", long = "libraries")]
#[structopt(short = 'l', long = "libraries")]
pub libraries: Vec<String>,
/// Output a single JSON document containing the specified information.
@@ -181,7 +181,7 @@ impl Default for Arguments {
impl Arguments {
/// A shortcut constructor.
pub fn new() -> Self {
Self::from_args()
Self::parse()
}
/// Validates the arguments.