Skip to content

Update Rust crate clap to v3.0.0-beta.5 #4039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ base64 = "0.13"
cargo-registry-markdown = { path = "cargo-registry-markdown" }
cargo-registry-s3 = { path = "cargo-registry-s3" }
chrono = { version = "0.4.0", features = ["serde"] }
clap = "=3.0.0-beta.4"
clap = "=3.0.0-beta.5"

conduit = "0.9.0-alpha.5"
conduit-conditional-get = "0.9.0-alpha.3"
Expand Down
3 changes: 1 addition & 2 deletions src/admin/delete_crate.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use crate::{admin::dialoguer, db, models::Crate, schema::crates};

use clap::Clap;
use diesel::prelude::*;

#[derive(Clap, Debug)]
#[derive(clap::Parser, Debug)]
#[clap(
name = "delete-crate",
about = "Purge all references to a crate from the database.",
Expand Down
3 changes: 1 addition & 2 deletions src/admin/delete_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ use crate::{
schema::versions,
};

use clap::Clap;
use diesel::prelude::*;

#[derive(Clap, Debug)]
#[derive(clap::Parser, Debug)]
#[clap(
name = "delete-version",
about = "Purge all references to a crate's version from the database.",
Expand Down
2 changes: 1 addition & 1 deletion src/admin/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use anyhow::Error;
static CATEGORIES_TOML: &str = include_str!("../boot/categories.toml");
diesel_migrations::embed_migrations!("./migrations");

#[derive(clap::Clap, Debug, Copy, Clone)]
#[derive(clap::Parser, Debug, Copy, Clone)]
#[clap(
name = "migrate",
about = "Verify config, migrate the database, and other release tasks."
Expand Down
3 changes: 1 addition & 2 deletions src/admin/populate.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use crate::{db, schema::version_downloads};

use clap::Clap;
use diesel::prelude::*;
use rand::{thread_rng, Rng};

#[derive(Clap, Debug)]
#[derive(clap::Parser, Debug)]
#[clap(
name = "populate",
about = "Populate a set of dummy download statistics for a specific version in the database."
Expand Down
3 changes: 1 addition & 2 deletions src/admin/render_readmes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use std::{io::Read, path::Path, sync::Arc, thread};

use cargo_registry_markdown::text_to_html;
use chrono::{TimeZone, Utc};
use clap::Clap;
use diesel::{dsl::any, prelude::*};
use flate2::read::GzDecoder;
use reqwest::{blocking::Client, header};
Expand All @@ -17,7 +16,7 @@ use tar::{self, Archive};
const CACHE_CONTROL_README: &str = "public,max-age=604800";
const USER_AGENT: &str = "crates-admin";

#[derive(Clap, Debug)]
#[derive(clap::Parser, Debug)]
#[clap(
name = "render-readmes",
about = "Iterates over every crate versions ever uploaded and (re-)renders their \
Expand Down
3 changes: 1 addition & 2 deletions src/admin/test_pagerduty.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use anyhow::Result;
use clap::Clap;
use std::str::FromStr;

use crate::admin::on_call;
Expand All @@ -24,7 +23,7 @@ impl FromStr for EventType {
}
}

#[derive(Clap, Debug)]
#[derive(clap::Parser, Debug)]
#[clap(name = "test-pagerduty", about = "Send a test event to pagerduty")]
pub struct Opts {
#[clap(possible_values = &["trigger", "acknowledge", "resolve"])]
Expand Down
3 changes: 1 addition & 2 deletions src/admin/transfer_crates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ use crate::{
};
use std::process::exit;

use clap::Clap;
use diesel::prelude::*;

#[derive(Clap, Debug)]
#[derive(clap::Parser, Debug)]
#[clap(
name = "transfer-crates",
about = "Transfer all crates from one user to another."
Expand Down
4 changes: 1 addition & 3 deletions src/admin/verify_token.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use crate::{db, models::User, util::errors::AppResult};

use clap::Clap;

#[derive(Clap, Debug)]
#[derive(clap::Parser, Debug)]
#[clap(
name = "verify-token",
about = "Look up a username by API token.",
Expand Down
8 changes: 4 additions & 4 deletions src/bin/crates-admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ use cargo_registry::admin::{
transfer_crates, verify_token,
};

use clap::Clap;

#[derive(Clap, Debug)]
#[derive(clap::Parser, Debug)]
#[clap(name = "crates-admin")]
struct Opts {
#[clap(subcommand)]
command: SubCommand,
}

#[derive(Clap, Debug)]
#[derive(clap::Parser, Debug)]
enum SubCommand {
DeleteCrate(delete_crate::Opts),
DeleteVersion(delete_version::Opts),
Expand All @@ -27,6 +25,8 @@ enum SubCommand {
}

fn main() -> anyhow::Result<()> {
use clap::Parser;

let opts: Opts = Opts::parse();

match opts.command {
Expand Down