fix(deps): upgrade clap

This commit is contained in:
Harsh Shandilya 2022-06-17 13:32:18 +05:30
parent 6fc48f0207
commit 49b8970143
No known key found for this signature in database
GPG Key ID: 366D7BBAD1031E80
6 changed files with 15 additions and 7 deletions

View File

@ -6,6 +6,7 @@
<sourceFolder url="file://$MODULE_DIR$/examples" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/benches" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/adx/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />

6
.idea/ktfmt.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KtfmtSettings">
<option name="enabled" value="false" />
</component>
</project>

View File

@ -13,7 +13,7 @@ readme = "../README.md"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
clap = { version = "3.2.5", features = [ "color", "derive" ] }
clap = { version = "3.2.5", features = [ "color", "deprecated", "derive" ] }
color-eyre = { version = "0.6.1", default-features = false }
futures = "0.3.21"
reqwest = { version = "0.11.11", default-features = false, features = ["rustls-tls"] }

View File

@ -3,6 +3,7 @@ use std::convert::TryFrom;
use std::fmt::Debug;
use std::str::FromStr;
use clap::ValueEnum;
use semver::{Prerelease, Version};
use thiserror::Error;
@ -10,7 +11,7 @@ use thiserror::Error;
/// Since we're deriving `PartialOrd` automatically, the order
/// of these fields is crucial. Sort by stability, not alphabetical
/// order.
#[derive(Debug, Eq, PartialEq, PartialOrd, Clone, Copy)]
#[derive(ValueEnum, Debug, Eq, PartialEq, PartialOrd, Clone, Copy)]
pub(crate) enum Channel {
Dev,
Alpha,

View File

@ -8,7 +8,7 @@ mod stats_alloc;
use std::alloc::System;
use channel::Channel;
use clap::{AppSettings, Parser};
use clap::{builder::PossibleValuesParser, AppSettings, Parser};
use color_eyre::Result;
#[cfg(feature = "measure-alloc")]
use stats_alloc::{Region, StatsAlloc, INSTRUMENTED_SYSTEM};
@ -26,7 +26,7 @@ pub(crate) struct Cli {
#[clap(required = true)]
pub(crate) search_term: String,
/// the release channel to find packages from
#[clap(short='c', long="channel", possible_values=&["alpha", "a", "beta", "b", "dev", "d", "rc", "r", "stable", "s"], default_value="a")]
#[clap(short='c', long="channel", value_parser=PossibleValuesParser::new(&["alpha", "a", "beta", "b", "dev", "d", "rc", "r", "stable", "s"]), default_value="a")]
pub(crate) channel: Channel,
}
@ -37,9 +37,9 @@ async fn main() -> Result<()> {
let reg = Region::new(GLOBAL);
let cli = Cli::parse();
#[cfg(feature = "measure-alloc")]
let packages = crate::parse::parse("", cli.channel).await?;
let packages = parse::parse("", cli.channel).await?;
#[cfg(not(feature = "measure-alloc"))]
let packages = crate::parse::parse(&cli.search_term, cli.channel).await?;
let packages = parse::parse(&cli.search_term, cli.channel).await?;
if packages.is_empty() {
println!("No results found!");
} else {

View File

@ -81,7 +81,7 @@ async fn parse_packages(groups: Vec<String>, channel: Channel) -> Result<Vec<Mav
Ok(merged_list
.into_iter()
.filter_map(std::result::Result::ok)
.filter_map(Result::ok)
.flatten()
.collect())
}