mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 18:07: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:
@@ -129,9 +129,9 @@ pub trait SubstrateCli: Sized {
|
||||
let about = Self::description();
|
||||
let app = app
|
||||
.name(name)
|
||||
.author(author.as_str())
|
||||
.about(about.as_str())
|
||||
.version(full_version.as_str())
|
||||
.author(author)
|
||||
.about(about)
|
||||
.version(full_version)
|
||||
.propagate_version(true)
|
||||
.args_conflicts_with_subcommands(true)
|
||||
.subcommand_negates_reqs(true);
|
||||
@@ -153,9 +153,9 @@ pub trait SubstrateCli: Sized {
|
||||
///
|
||||
/// **NOTE:** This method WILL NOT exit when `--help` or `--version` (or short versions) are
|
||||
/// used. It will return a [`clap::Error`], where the [`clap::Error::kind`] is a
|
||||
/// [`clap::ErrorKind::DisplayHelp`] or [`clap::ErrorKind::DisplayVersion`] respectively.
|
||||
/// You must call [`clap::Error::exit`] or perform a [`std::process::exit`].
|
||||
fn try_from_iter<I>(iter: I) -> clap::Result<Self>
|
||||
/// [`clap::error::ErrorKind::DisplayHelp`] or [`clap::error::ErrorKind::DisplayVersion`]
|
||||
/// respectively. You must call [`clap::Error::exit`] or perform a [`std::process::exit`].
|
||||
fn try_from_iter<I>(iter: I) -> clap::error::Result<Self>
|
||||
where
|
||||
Self: Parser + Sized,
|
||||
I: IntoIterator,
|
||||
@@ -169,11 +169,7 @@ pub trait SubstrateCli: Sized {
|
||||
let name = Self::executable_name();
|
||||
let author = Self::author();
|
||||
let about = Self::description();
|
||||
let app = app
|
||||
.name(name)
|
||||
.author(author.as_str())
|
||||
.about(about.as_str())
|
||||
.version(full_version.as_str());
|
||||
let app = app.name(name).author(author).about(about).version(full_version);
|
||||
|
||||
let matches = app.try_get_matches_from(iter)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user