mirror of https://github.com/msfjarvis/adx.git
fix(deps): upgrade clap
This commit is contained in:
parent
6fc48f0207
commit
49b8970143
|
@ -6,6 +6,7 @@
|
||||||
<sourceFolder url="file://$MODULE_DIR$/examples" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/examples" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/benches" 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" />
|
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="KtfmtSettings">
|
||||||
|
<option name="enabled" value="false" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -13,7 +13,7 @@ readme = "../README.md"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[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 }
|
color-eyre = { version = "0.6.1", default-features = false }
|
||||||
futures = "0.3.21"
|
futures = "0.3.21"
|
||||||
reqwest = { version = "0.11.11", default-features = false, features = ["rustls-tls"] }
|
reqwest = { version = "0.11.11", default-features = false, features = ["rustls-tls"] }
|
||||||
|
|
|
@ -3,6 +3,7 @@ use std::convert::TryFrom;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
use clap::ValueEnum;
|
||||||
use semver::{Prerelease, Version};
|
use semver::{Prerelease, Version};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
|
@ -10,7 +11,7 @@ use thiserror::Error;
|
||||||
/// Since we're deriving `PartialOrd` automatically, the order
|
/// Since we're deriving `PartialOrd` automatically, the order
|
||||||
/// of these fields is crucial. Sort by stability, not alphabetical
|
/// of these fields is crucial. Sort by stability, not alphabetical
|
||||||
/// order.
|
/// order.
|
||||||
#[derive(Debug, Eq, PartialEq, PartialOrd, Clone, Copy)]
|
#[derive(ValueEnum, Debug, Eq, PartialEq, PartialOrd, Clone, Copy)]
|
||||||
pub(crate) enum Channel {
|
pub(crate) enum Channel {
|
||||||
Dev,
|
Dev,
|
||||||
Alpha,
|
Alpha,
|
||||||
|
|
|
@ -8,7 +8,7 @@ mod stats_alloc;
|
||||||
use std::alloc::System;
|
use std::alloc::System;
|
||||||
|
|
||||||
use channel::Channel;
|
use channel::Channel;
|
||||||
use clap::{AppSettings, Parser};
|
use clap::{builder::PossibleValuesParser, AppSettings, Parser};
|
||||||
use color_eyre::Result;
|
use color_eyre::Result;
|
||||||
#[cfg(feature = "measure-alloc")]
|
#[cfg(feature = "measure-alloc")]
|
||||||
use stats_alloc::{Region, StatsAlloc, INSTRUMENTED_SYSTEM};
|
use stats_alloc::{Region, StatsAlloc, INSTRUMENTED_SYSTEM};
|
||||||
|
@ -26,7 +26,7 @@ pub(crate) struct Cli {
|
||||||
#[clap(required = true)]
|
#[clap(required = true)]
|
||||||
pub(crate) search_term: String,
|
pub(crate) search_term: String,
|
||||||
/// the release channel to find packages from
|
/// 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,
|
pub(crate) channel: Channel,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,9 +37,9 @@ async fn main() -> Result<()> {
|
||||||
let reg = Region::new(GLOBAL);
|
let reg = Region::new(GLOBAL);
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
#[cfg(feature = "measure-alloc")]
|
#[cfg(feature = "measure-alloc")]
|
||||||
let packages = crate::parse::parse("", cli.channel).await?;
|
let packages = parse::parse("", cli.channel).await?;
|
||||||
#[cfg(not(feature = "measure-alloc"))]
|
#[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() {
|
if packages.is_empty() {
|
||||||
println!("No results found!");
|
println!("No results found!");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -81,7 +81,7 @@ async fn parse_packages(groups: Vec<String>, channel: Channel) -> Result<Vec<Mav
|
||||||
|
|
||||||
Ok(merged_list
|
Ok(merged_list
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(std::result::Result::ok)
|
.filter_map(Result::ok)
|
||||||
.flatten()
|
.flatten()
|
||||||
.collect())
|
.collect())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue