diff options
| author | Nicholas Rodrigues Lordello <[email protected]> | 2022-01-14 09:46:57 +0100 |
|---|---|---|
| committer | Nicholas Rodrigues Lordello <[email protected]> | 2022-01-14 09:46:57 +0100 |
| commit | a3c2005b0b57ba66d612dea7281ae95c1ad445c4 (patch) | |
| tree | ba5cdca434c10eb9941f1cc370544b5235d9bd14 /src/cmd | |
| parent | 22ccb7895637e041c17a76eb96c54f16a00e182d (diff) | |
migrate to clap
Diffstat (limited to 'src/cmd')
| -rw-r--r-- | src/cmd/address.rs | 6 | ||||
| -rw-r--r-- | src/cmd/export.rs | 6 | ||||
| -rw-r--r-- | src/cmd/hash.rs | 6 | ||||
| -rw-r--r-- | src/cmd/hex.rs | 12 | ||||
| -rw-r--r-- | src/cmd/new.rs | 8 | ||||
| -rw-r--r-- | src/cmd/public_key.rs | 6 | ||||
| -rw-r--r-- | src/cmd/sign.rs | 24 |
7 files changed, 34 insertions, 34 deletions
diff --git a/src/cmd/address.rs b/src/cmd/address.rs index 91476d3..28ed8fd 100644 --- a/src/cmd/address.rs +++ b/src/cmd/address.rs @@ -3,11 +3,11 @@ use crate::cmd::AccountOptions; use anyhow::Result; -use structopt::StructOpt; +use clap::Parser; -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] pub struct Options { - #[structopt(flatten)] + #[clap(flatten)] account: AccountOptions, } diff --git a/src/cmd/export.rs b/src/cmd/export.rs index 957cd0e..df11d08 100644 --- a/src/cmd/export.rs +++ b/src/cmd/export.rs @@ -3,11 +3,11 @@ use crate::cmd::AccountOptions; use anyhow::Result; -use structopt::StructOpt; +use clap::Parser; -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] pub struct Options { - #[structopt(flatten)] + #[clap(flatten)] account: AccountOptions, } diff --git a/src/cmd/hash.rs b/src/cmd/hash.rs index 4a650ff..4c8a9b8 100644 --- a/src/cmd/hash.rs +++ b/src/cmd/hash.rs @@ -2,14 +2,14 @@ use crate::cmd; use anyhow::Result; +use clap::Parser; use hdwallet::hash; use std::path::PathBuf; -use structopt::StructOpt; -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] pub struct Options { /// Path to the data to hash. Use `-` for standard in. - #[structopt(name = "DATA", default_value = "-")] + #[clap(name = "DATA", default_value = "-")] data: PathBuf, } diff --git a/src/cmd/hex.rs b/src/cmd/hex.rs index 48eb02f..143bc43 100644 --- a/src/cmd/hex.rs +++ b/src/cmd/hex.rs @@ -6,32 +6,32 @@ use crate::cmd; use anyhow::Result; +use clap::Parser; use std::{ io::{self, Write}, path::PathBuf, str, }; -use structopt::StructOpt; -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] pub struct Options { - #[structopt(subcommand)] + #[clap(subcommand)] op: Op, } -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] enum Op { /// Encode binary data as a hexadecimal string. Encode { /// Path to the data to encode. Use `-` for standard in. - #[structopt(name = "DATA", default_value = "-")] + #[clap(name = "DATA", default_value = "-")] data: PathBuf, }, /// Decode a hexadecimal string as binary data. Decode { /// Path to the data to decode. Use `-` for standard in. - #[structopt(name = "DATA", default_value = "-")] + #[clap(name = "DATA", default_value = "-")] data: PathBuf, }, } diff --git a/src/cmd/new.rs b/src/cmd/new.rs index 002e5d0..db89958 100644 --- a/src/cmd/new.rs +++ b/src/cmd/new.rs @@ -2,17 +2,17 @@ //! hierarchical deterministic wallet. use anyhow::Result; +use clap::Parser; use hdwallet::mnemonic::{Language, Mnemonic}; -use structopt::StructOpt; -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] pub struct Options { /// The number of words for the mnemonic phrase. - #[structopt(short = "n", long, default_value = "12")] + #[clap(short = 'n', long, default_value_t = 12)] length: usize, /// The language to generate the mnemonic for. - #[structopt(short, long, default_value)] + #[clap(short, long, default_value_t)] language: Language, } diff --git a/src/cmd/public_key.rs b/src/cmd/public_key.rs index 31e5d0a..360255b 100644 --- a/src/cmd/public_key.rs +++ b/src/cmd/public_key.rs @@ -3,11 +3,11 @@ use crate::cmd::AccountOptions; use anyhow::Result; -use structopt::StructOpt; +use clap::Parser; -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] pub struct Options { - #[structopt(flatten)] + #[clap(flatten)] account: AccountOptions, } diff --git a/src/cmd/sign.rs b/src/cmd/sign.rs index f292f0d..f0a7c89 100644 --- a/src/cmd/sign.rs +++ b/src/cmd/sign.rs @@ -2,40 +2,40 @@ use crate::cmd::{self, AccountOptions}; use anyhow::{ensure, Context as _, Result}; +use clap::Parser; use hdwallet::{ hash, transaction::{LegacyTransaction, Transaction}, typeddata::TypedData, }; use std::{convert::TryInto, path::PathBuf}; -use structopt::StructOpt; -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] pub struct Options { - #[structopt(subcommand)] + #[clap(subcommand)] input: Input, - #[structopt(flatten)] + #[clap(flatten)] account: AccountOptions, } -#[derive(Debug, StructOpt)] -#[structopt(rename_all = "lowercase")] +#[derive(Debug, Parser)] +#[clap(rename_all = "lowercase")] enum Input { /// Sign an Ethereum transaction. Transaction { /// Path to transaction to sign in JSON format. - #[structopt(name = "TRANSACTION")] + #[clap(name = "TRANSACTION")] transaction: PathBuf, /// Only output the transaction signature instead of the RLP-encoded /// signed transaction. - #[structopt(long)] + #[clap(long)] signature_only: bool, /// Force allowing legacy transactions without a chain ID for relay /// protection. Use this care! - #[structopt(long)] + #[clap(long)] allow_missing_relay_protection: bool, }, @@ -44,21 +44,21 @@ enum Input { /// Path to the message to sign in the "eth_sign" scheme. This message /// will be prefixed with "\x19Ethereum Signed Message:\n" and its /// length before hashing and singing. - #[structopt(name = "MESSAGE")] + #[clap(name = "MESSAGE")] message: PathBuf, }, /// Sign EIP-712 typed data. TypedData { /// Path to the EIP-712 typed data in JSON format. - #[structopt(name = "TYPEDDATA")] + #[clap(name = "TYPEDDATA")] typed_data: PathBuf, }, /// Sign a raw data. Raw { /// The 32 byte message to sign specified as a hexadecimal string. - #[structopt(name = "BYTES", parse(try_from_str = permissive_hex_digest))] + #[clap(name = "BYTES", parse(try_from_str = permissive_hex_digest))] message: [u8; 32], }, } |
