mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 20:27:58 +00:00
Bump clap to 4.0.x and adjust to best practices (#12381)
* Bump clap to 3.2.22 * Replace `from_os_str` with `value_parser` * Replace `from_str` and `try_from_str` with `value_parser` * Move possible_values to the new format * Remove unwanted print * Add missing match branch * Update clap to 4.0.9 and make it compile * Replace deprecated `clap` macro with `command` and `value` * Move remaining `clap` attributes to `arg` * Remove no-op value_parsers * Adjust value_parser for state_version * Remove "deprecated" feature flag and bump to 4.0.11 * Improve range Co-authored-by: Bastian Köcher <git@kchr.de> * Apply suggestions * Trigger CI * Fix unused error warning * Fix doc errors * Fix ArgGroup naming conflict * Change default_value to default_value_t * Use 1.. instead of 0.. Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
@@ -34,14 +34,14 @@ use std::io::Write;
|
||||
#[derive(Debug, Clone, Parser)]
|
||||
pub struct BuildSpecCmd {
|
||||
/// Force raw genesis storage output.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
pub raw: bool,
|
||||
|
||||
/// Disable adding the default bootnode to the specification.
|
||||
///
|
||||
/// By default the `/ip4/127.0.0.1/tcp/30333/p2p/NODE_PEER_ID` bootnode is added to the
|
||||
/// specification when no bootnode exists.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
pub disable_default_bootnode: bool,
|
||||
|
||||
#[allow(missing_docs)]
|
||||
|
||||
@@ -30,13 +30,13 @@ use std::{fmt::Debug, str::FromStr, sync::Arc};
|
||||
#[derive(Debug, Clone, Parser)]
|
||||
pub struct CheckBlockCmd {
|
||||
/// Block hash or number
|
||||
#[clap(value_name = "HASH or NUMBER")]
|
||||
#[arg(value_name = "HASH or NUMBER")]
|
||||
pub input: BlockNumberOrHash,
|
||||
|
||||
/// The default number of 64KB pages to ever allocate for Wasm execution.
|
||||
///
|
||||
/// Don't alter this unless you know what you're doing.
|
||||
#[clap(long, value_name = "COUNT")]
|
||||
#[arg(long, value_name = "COUNT")]
|
||||
pub default_heap_pages: Option<u32>,
|
||||
|
||||
#[allow(missing_docs)]
|
||||
|
||||
@@ -32,23 +32,23 @@ use std::{fmt::Debug, fs, io, path::PathBuf, str::FromStr, sync::Arc};
|
||||
#[derive(Debug, Clone, Parser)]
|
||||
pub struct ExportBlocksCmd {
|
||||
/// Output file name or stdout if unspecified.
|
||||
#[clap(parse(from_os_str))]
|
||||
#[arg()]
|
||||
pub output: Option<PathBuf>,
|
||||
|
||||
/// Specify starting block number.
|
||||
///
|
||||
/// Default is 1.
|
||||
#[clap(long, value_name = "BLOCK")]
|
||||
#[arg(long, value_name = "BLOCK")]
|
||||
pub from: Option<GenericNumber>,
|
||||
|
||||
/// Specify last block number.
|
||||
///
|
||||
/// Default is best block.
|
||||
#[clap(long, value_name = "BLOCK")]
|
||||
#[arg(long, value_name = "BLOCK")]
|
||||
pub to: Option<GenericNumber>,
|
||||
|
||||
/// Use binary output rather than JSON.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
pub binary: bool,
|
||||
|
||||
#[allow(missing_docs)]
|
||||
|
||||
@@ -32,7 +32,7 @@ use std::{fmt::Debug, io::Write, str::FromStr, sync::Arc};
|
||||
#[derive(Debug, Clone, Parser)]
|
||||
pub struct ExportStateCmd {
|
||||
/// Block hash or number.
|
||||
#[clap(value_name = "HASH or NUMBER")]
|
||||
#[arg(value_name = "HASH or NUMBER")]
|
||||
pub input: Option<BlockNumberOrHash>,
|
||||
|
||||
#[allow(missing_docs)]
|
||||
|
||||
@@ -25,10 +25,10 @@ use clap::Parser;
|
||||
|
||||
/// The `generate` command
|
||||
#[derive(Debug, Clone, Parser)]
|
||||
#[clap(name = "generate", about = "Generate a random account")]
|
||||
#[command(name = "generate", about = "Generate a random account")]
|
||||
pub struct GenerateCmd {
|
||||
/// The number of words in the phrase to generate. One of 12 (default), 15, 18, 21 and 24.
|
||||
#[clap(short = 'w', long, value_name = "WORDS")]
|
||||
#[arg(short = 'w', long, value_name = "WORDS")]
|
||||
words: Option<usize>,
|
||||
|
||||
#[allow(missing_docs)]
|
||||
|
||||
@@ -28,7 +28,7 @@ use std::{
|
||||
|
||||
/// The `generate-node-key` command
|
||||
#[derive(Debug, Parser)]
|
||||
#[clap(
|
||||
#[command(
|
||||
name = "generate-node-key",
|
||||
about = "Generate a random node key, write it to a file or stdout \
|
||||
and write the corresponding peer-id to stderr"
|
||||
@@ -37,13 +37,13 @@ pub struct GenerateNodeKeyCmd {
|
||||
/// Name of file to save secret key to.
|
||||
///
|
||||
/// If not given, the secret key is printed to stdout.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
file: Option<PathBuf>,
|
||||
|
||||
/// The output is in raw binary format.
|
||||
///
|
||||
/// If not given, the output is written as an hex encoded string.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
bin: bool,
|
||||
}
|
||||
|
||||
|
||||
@@ -37,17 +37,17 @@ use std::{
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct ImportBlocksCmd {
|
||||
/// Input file or stdin if unspecified.
|
||||
#[clap(parse(from_os_str))]
|
||||
#[arg()]
|
||||
pub input: Option<PathBuf>,
|
||||
|
||||
/// The default number of 64KB pages to ever allocate for Wasm execution.
|
||||
///
|
||||
/// Don't alter this unless you know what you're doing.
|
||||
#[clap(long, value_name = "COUNT")]
|
||||
#[arg(long, value_name = "COUNT")]
|
||||
pub default_heap_pages: Option<u32>,
|
||||
|
||||
/// Try importing blocks from binary format rather than JSON.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
pub binary: bool,
|
||||
|
||||
#[allow(missing_docs)]
|
||||
|
||||
@@ -29,16 +29,16 @@ use std::sync::Arc;
|
||||
|
||||
/// The `insert` command
|
||||
#[derive(Debug, Clone, Parser)]
|
||||
#[clap(name = "insert", about = "Insert a key to the keystore of a node.")]
|
||||
#[command(name = "insert", about = "Insert a key to the keystore of a node.")]
|
||||
pub struct InsertKeyCmd {
|
||||
/// The secret key URI.
|
||||
/// If the value is a file, the file content is used as URI.
|
||||
/// If not given, you will be prompted for the URI.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
suri: Option<String>,
|
||||
|
||||
/// Key type, examples: "gran", or "imon"
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
key_type: String,
|
||||
|
||||
#[allow(missing_docs)]
|
||||
@@ -50,7 +50,7 @@ pub struct InsertKeyCmd {
|
||||
pub keystore_params: KeystoreParams,
|
||||
|
||||
/// The cryptography scheme that should be used to generate the key out of the given URI.
|
||||
#[clap(long, value_name = "SCHEME", arg_enum, ignore_case = true)]
|
||||
#[arg(long, value_name = "SCHEME", value_enum, ignore_case = true)]
|
||||
pub scheme: CryptoScheme,
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ use std::str::FromStr;
|
||||
|
||||
/// The `inspect` command
|
||||
#[derive(Debug, Parser)]
|
||||
#[clap(
|
||||
#[command(
|
||||
name = "inspect",
|
||||
about = "Gets a public key and a SS58 address from the provided Secret URI"
|
||||
)]
|
||||
@@ -44,7 +44,7 @@ pub struct InspectKeyCmd {
|
||||
uri: Option<String>,
|
||||
|
||||
/// Is the given `uri` a hex encoded public key?
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
public: bool,
|
||||
|
||||
#[allow(missing_docs)]
|
||||
@@ -72,7 +72,7 @@ pub struct InspectKeyCmd {
|
||||
///
|
||||
/// If there is no derivation in `--uri`, the public key will be checked against the public key
|
||||
/// of `--uri` directly.
|
||||
#[clap(long, conflicts_with = "public")]
|
||||
#[arg(long, conflicts_with = "public")]
|
||||
pub expect_public: Option<String>,
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ use std::{
|
||||
|
||||
/// The `inspect-node-key` command
|
||||
#[derive(Debug, Parser)]
|
||||
#[clap(
|
||||
#[command(
|
||||
name = "inspect-node-key",
|
||||
about = "Load a node key from a file or stdin and print the corresponding peer-id."
|
||||
)]
|
||||
@@ -36,18 +36,18 @@ pub struct InspectNodeKeyCmd {
|
||||
/// Name of file to read the secret key from.
|
||||
///
|
||||
/// If not given, the secret key is read from stdin (up to EOF).
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
file: Option<PathBuf>,
|
||||
|
||||
/// The input is in raw binary format.
|
||||
///
|
||||
/// If not given, the input is read as an hex encoded string.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
bin: bool,
|
||||
|
||||
/// This argument is deprecated and has no effect for this command.
|
||||
#[deprecated(note = "Network identifier is not used for node-key inspection")]
|
||||
#[clap(short = 'n', long = "network", value_name = "NETWORK", ignore_case = true)]
|
||||
#[arg(short = 'n', long = "network", value_name = "NETWORK", ignore_case = true)]
|
||||
pub network_scheme: Option<String>,
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ use std::{
|
||||
#[derive(Debug, Clone, Parser)]
|
||||
pub struct PurgeChainCmd {
|
||||
/// Skip interactive prompt by answering yes automatically.
|
||||
#[clap(short = 'y')]
|
||||
#[arg(short = 'y')]
|
||||
pub yes: bool,
|
||||
|
||||
#[allow(missing_docs)]
|
||||
|
||||
@@ -31,7 +31,7 @@ use std::{fmt::Debug, str::FromStr, sync::Arc};
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct RevertCmd {
|
||||
/// Number of blocks to revert.
|
||||
#[clap(default_value = "256")]
|
||||
#[arg(default_value = "256")]
|
||||
pub num: GenericNumber,
|
||||
|
||||
#[allow(missing_docs)]
|
||||
|
||||
@@ -42,12 +42,12 @@ pub struct RunCmd {
|
||||
/// The node will be started with the authority role and actively
|
||||
/// participate in any consensus task that it can (e.g. depending on
|
||||
/// availability of local keys).
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
pub validator: bool,
|
||||
|
||||
/// Disable GRANDPA voter when running in validator mode, otherwise disable the GRANDPA
|
||||
/// observer.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
pub no_grandpa: bool,
|
||||
|
||||
/// Listen to all RPC interfaces.
|
||||
@@ -56,13 +56,13 @@ pub struct RunCmd {
|
||||
/// proxy server to filter out dangerous methods. More details:
|
||||
/// <https://docs.substrate.io/main-docs/build/custom-rpc/#public-rpcs>.
|
||||
/// Use `--unsafe-rpc-external` to suppress the warning if you understand the risks.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
pub rpc_external: bool,
|
||||
|
||||
/// Listen to all RPC interfaces.
|
||||
///
|
||||
/// Same as `--rpc-external`.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
pub unsafe_rpc_external: bool,
|
||||
|
||||
/// RPC methods to expose.
|
||||
@@ -71,12 +71,12 @@ pub struct RunCmd {
|
||||
/// - `safe`: Exposes only a safe subset of RPC methods, denying unsafe RPC methods.
|
||||
/// - `auto`: Acts as `safe` if RPC is served externally, e.g. when `--{rpc,ws}-external` is
|
||||
/// passed, otherwise acts as `unsafe`.
|
||||
#[clap(
|
||||
#[arg(
|
||||
long,
|
||||
value_name = "METHOD SET",
|
||||
arg_enum,
|
||||
value_enum,
|
||||
ignore_case = true,
|
||||
default_value = "auto",
|
||||
default_value_t = RpcMethods::Auto,
|
||||
verbatim_doc_comment
|
||||
)]
|
||||
pub rpc_methods: RpcMethods,
|
||||
@@ -87,59 +87,59 @@ pub struct RunCmd {
|
||||
/// proxy server to filter out dangerous methods. More details:
|
||||
/// <https://docs.substrate.io/main-docs/build/custom-rpc/#public-rpcs>.
|
||||
/// Use `--unsafe-ws-external` to suppress the warning if you understand the risks.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
pub ws_external: bool,
|
||||
|
||||
/// Listen to all Websocket interfaces.
|
||||
///
|
||||
/// Same as `--ws-external` but doesn't warn you about it.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
pub unsafe_ws_external: bool,
|
||||
|
||||
/// DEPRECATED, this has no affect anymore. Use `rpc_max_request_size` or
|
||||
/// `rpc_max_response_size` instead.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
pub rpc_max_payload: Option<usize>,
|
||||
|
||||
/// Set the the maximum RPC request payload size for both HTTP and WS in megabytes.
|
||||
/// Default is 15MiB.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
pub rpc_max_request_size: Option<usize>,
|
||||
|
||||
/// Set the the maximum RPC response payload size for both HTTP and WS in megabytes.
|
||||
/// Default is 15MiB.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
pub rpc_max_response_size: Option<usize>,
|
||||
|
||||
/// Set the the maximum concurrent subscriptions per connection.
|
||||
/// Default is 1024.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
pub rpc_max_subscriptions_per_connection: Option<usize>,
|
||||
|
||||
/// Expose Prometheus exporter on all interfaces.
|
||||
///
|
||||
/// Default is local.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
pub prometheus_external: bool,
|
||||
|
||||
/// DEPRECATED, IPC support has been removed.
|
||||
#[clap(long, value_name = "PATH")]
|
||||
#[arg(long, value_name = "PATH")]
|
||||
pub ipc_path: Option<String>,
|
||||
|
||||
/// Specify HTTP RPC server TCP port.
|
||||
#[clap(long, value_name = "PORT")]
|
||||
#[arg(long, value_name = "PORT")]
|
||||
pub rpc_port: Option<u16>,
|
||||
|
||||
/// Specify WebSockets RPC server TCP port.
|
||||
#[clap(long, value_name = "PORT")]
|
||||
#[arg(long, value_name = "PORT")]
|
||||
pub ws_port: Option<u16>,
|
||||
|
||||
/// Maximum number of WS RPC server connections.
|
||||
#[clap(long, value_name = "COUNT")]
|
||||
#[arg(long, value_name = "COUNT")]
|
||||
pub ws_max_connections: Option<usize>,
|
||||
|
||||
/// DEPRECATED, this has no affect anymore. Use `rpc_max_response_size` instead.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
pub ws_max_out_buffer_capacity: Option<usize>,
|
||||
|
||||
/// Specify browser Origins allowed to access the HTTP & WS RPC servers.
|
||||
@@ -148,29 +148,29 @@ pub struct RunCmd {
|
||||
/// value). Value of `all` will disable origin validation. Default is to
|
||||
/// allow localhost and <https://polkadot.js.org> origins. When running in
|
||||
/// --dev mode the default is to allow all origins.
|
||||
#[clap(long, value_name = "ORIGINS", parse(from_str = parse_cors))]
|
||||
#[arg(long, value_name = "ORIGINS", value_parser = parse_cors)]
|
||||
pub rpc_cors: Option<Cors>,
|
||||
|
||||
/// Specify Prometheus exporter TCP Port.
|
||||
#[clap(long, value_name = "PORT")]
|
||||
#[arg(long, value_name = "PORT")]
|
||||
pub prometheus_port: Option<u16>,
|
||||
|
||||
/// Do not expose a Prometheus exporter endpoint.
|
||||
///
|
||||
/// Prometheus metric endpoint is enabled by default.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
pub no_prometheus: bool,
|
||||
|
||||
/// The human-readable name for this node.
|
||||
///
|
||||
/// The node name will be reported to the telemetry server, if enabled.
|
||||
#[clap(long, value_name = "NAME")]
|
||||
#[arg(long, value_name = "NAME")]
|
||||
pub name: Option<String>,
|
||||
|
||||
/// Disable connecting to the Substrate telemetry server.
|
||||
///
|
||||
/// Telemetry is on by default on global chains.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
pub no_telemetry: bool,
|
||||
|
||||
/// The URL of the telemetry server to connect to.
|
||||
@@ -179,7 +179,7 @@ pub struct RunCmd {
|
||||
/// telemetry endpoints. Verbosity levels range from 0-9, with 0 denoting
|
||||
/// the least verbosity.
|
||||
/// Expected format is 'URL VERBOSITY', e.g. `--telemetry-url 'wss://foo/bar 0'`.
|
||||
#[clap(long = "telemetry-url", value_name = "URL VERBOSITY", parse(try_from_str = parse_telemetry_endpoints))]
|
||||
#[arg(long = "telemetry-url", value_name = "URL VERBOSITY", value_parser = parse_telemetry_endpoints)]
|
||||
pub telemetry_endpoints: Vec<(String, u8)>,
|
||||
|
||||
#[allow(missing_docs)]
|
||||
@@ -203,40 +203,40 @@ pub struct RunCmd {
|
||||
pub pool_config: TransactionPoolParams,
|
||||
|
||||
/// Shortcut for `--name Alice --validator` with session keys for `Alice` added to keystore.
|
||||
#[clap(long, conflicts_with_all = &["bob", "charlie", "dave", "eve", "ferdie", "one", "two"])]
|
||||
#[arg(long, conflicts_with_all = &["bob", "charlie", "dave", "eve", "ferdie", "one", "two"])]
|
||||
pub alice: bool,
|
||||
|
||||
/// Shortcut for `--name Bob --validator` with session keys for `Bob` added to keystore.
|
||||
#[clap(long, conflicts_with_all = &["alice", "charlie", "dave", "eve", "ferdie", "one", "two"])]
|
||||
#[arg(long, conflicts_with_all = &["alice", "charlie", "dave", "eve", "ferdie", "one", "two"])]
|
||||
pub bob: bool,
|
||||
|
||||
/// Shortcut for `--name Charlie --validator` with session keys for `Charlie` added to
|
||||
/// keystore.
|
||||
#[clap(long, conflicts_with_all = &["alice", "bob", "dave", "eve", "ferdie", "one", "two"])]
|
||||
#[arg(long, conflicts_with_all = &["alice", "bob", "dave", "eve", "ferdie", "one", "two"])]
|
||||
pub charlie: bool,
|
||||
|
||||
/// Shortcut for `--name Dave --validator` with session keys for `Dave` added to keystore.
|
||||
#[clap(long, conflicts_with_all = &["alice", "bob", "charlie", "eve", "ferdie", "one", "two"])]
|
||||
#[arg(long, conflicts_with_all = &["alice", "bob", "charlie", "eve", "ferdie", "one", "two"])]
|
||||
pub dave: bool,
|
||||
|
||||
/// Shortcut for `--name Eve --validator` with session keys for `Eve` added to keystore.
|
||||
#[clap(long, conflicts_with_all = &["alice", "bob", "charlie", "dave", "ferdie", "one", "two"])]
|
||||
#[arg(long, conflicts_with_all = &["alice", "bob", "charlie", "dave", "ferdie", "one", "two"])]
|
||||
pub eve: bool,
|
||||
|
||||
/// Shortcut for `--name Ferdie --validator` with session keys for `Ferdie` added to keystore.
|
||||
#[clap(long, conflicts_with_all = &["alice", "bob", "charlie", "dave", "eve", "one", "two"])]
|
||||
#[arg(long, conflicts_with_all = &["alice", "bob", "charlie", "dave", "eve", "one", "two"])]
|
||||
pub ferdie: bool,
|
||||
|
||||
/// Shortcut for `--name One --validator` with session keys for `One` added to keystore.
|
||||
#[clap(long, conflicts_with_all = &["alice", "bob", "charlie", "dave", "eve", "ferdie", "two"])]
|
||||
#[arg(long, conflicts_with_all = &["alice", "bob", "charlie", "dave", "eve", "ferdie", "two"])]
|
||||
pub one: bool,
|
||||
|
||||
/// Shortcut for `--name Two --validator` with session keys for `Two` added to keystore.
|
||||
#[clap(long, conflicts_with_all = &["alice", "bob", "charlie", "dave", "eve", "ferdie", "one"])]
|
||||
#[arg(long, conflicts_with_all = &["alice", "bob", "charlie", "dave", "eve", "ferdie", "one"])]
|
||||
pub two: bool,
|
||||
|
||||
/// Enable authoring even when offline.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
pub force_authoring: bool,
|
||||
|
||||
#[allow(missing_docs)]
|
||||
@@ -246,11 +246,11 @@ pub struct RunCmd {
|
||||
/// The size of the instances cache for each runtime.
|
||||
///
|
||||
/// The default value is 8 and the values higher than 256 are ignored.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
pub max_runtime_instances: Option<usize>,
|
||||
|
||||
/// Maximum number of different runtimes that can be cached.
|
||||
#[clap(long, default_value = "2")]
|
||||
#[arg(long, default_value_t = 2)]
|
||||
pub runtime_cache_size: u8,
|
||||
|
||||
/// Run a temporary node.
|
||||
@@ -262,7 +262,7 @@ pub struct RunCmd {
|
||||
/// which includes: database, node key and keystore.
|
||||
///
|
||||
/// When `--dev` is given and no explicit `--base-path`, this option is implied.
|
||||
#[clap(long, conflicts_with = "base-path")]
|
||||
#[arg(long, conflicts_with = "base_path")]
|
||||
pub tmp: bool,
|
||||
}
|
||||
|
||||
@@ -597,7 +597,7 @@ impl From<Cors> for Option<Vec<String>> {
|
||||
}
|
||||
|
||||
/// Parse cors origins.
|
||||
fn parse_cors(s: &str) -> Cors {
|
||||
fn parse_cors(s: &str) -> Result<Cors> {
|
||||
let mut is_all = false;
|
||||
let mut origins = Vec::new();
|
||||
for part in s.split(',') {
|
||||
@@ -611,9 +611,9 @@ fn parse_cors(s: &str) -> Cors {
|
||||
}
|
||||
|
||||
if is_all {
|
||||
Cors::All
|
||||
Ok(Cors::All)
|
||||
} else {
|
||||
Cors::List(origins)
|
||||
Ok(Cors::List(origins))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,21 +23,21 @@ use sp_core::crypto::SecretString;
|
||||
|
||||
/// The `sign` command
|
||||
#[derive(Debug, Clone, Parser)]
|
||||
#[clap(name = "sign", about = "Sign a message, with a given (secret) key")]
|
||||
#[command(name = "sign", about = "Sign a message, with a given (secret) key")]
|
||||
pub struct SignCmd {
|
||||
/// The secret key URI.
|
||||
/// If the value is a file, the file content is used as URI.
|
||||
/// If not given, you will be prompted for the URI.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
suri: Option<String>,
|
||||
|
||||
/// Message to sign, if not provided you will be prompted to
|
||||
/// pass the message via STDIN
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
message: Option<String>,
|
||||
|
||||
/// The message on STDIN is hex-encoded data
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
hex: bool,
|
||||
|
||||
#[allow(missing_docs)]
|
||||
|
||||
@@ -29,10 +29,10 @@ use utils::print_from_uri;
|
||||
|
||||
/// The `vanity` command
|
||||
#[derive(Debug, Clone, Parser)]
|
||||
#[clap(name = "vanity", about = "Generate a seed that provides a vanity address")]
|
||||
#[command(name = "vanity", about = "Generate a seed that provides a vanity address")]
|
||||
pub struct VanityCmd {
|
||||
/// Desired pattern
|
||||
#[clap(long, parse(try_from_str = assert_non_empty_string))]
|
||||
#[arg(long, value_parser = assert_non_empty_string)]
|
||||
pattern: String,
|
||||
|
||||
#[allow(missing_docs)]
|
||||
|
||||
@@ -24,7 +24,7 @@ use sp_core::crypto::{ByteArray, Ss58Codec};
|
||||
|
||||
/// The `verify` command
|
||||
#[derive(Debug, Clone, Parser)]
|
||||
#[clap(
|
||||
#[command(
|
||||
name = "verify",
|
||||
about = "Verify a signature for a message, provided on STDIN, with a given (public or secret) key"
|
||||
)]
|
||||
@@ -39,11 +39,11 @@ pub struct VerifyCmd {
|
||||
|
||||
/// Message to verify, if not provided you will be prompted to
|
||||
/// pass the message via STDIN
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
message: Option<String>,
|
||||
|
||||
/// The message on STDIN is hex-encoded data
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
hex: bool,
|
||||
|
||||
#[allow(missing_docs)]
|
||||
|
||||
Reference in New Issue
Block a user