cli: clap 3.0.x (#1370)

This commit is contained in:
Armani Ferrante 2022-01-27 19:32:58 -05:00 committed by GitHub
parent aa0ad43810
commit e6333e3554
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 26 deletions

35
Cargo.lock generated
View File

@ -115,7 +115,7 @@ version = "0.20.1"
dependencies = [
"anchor-syn",
"anyhow",
"heck",
"heck 0.3.3",
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.81",
@ -153,10 +153,10 @@ dependencies = [
"anyhow",
"cargo_toml",
"chrono",
"clap 3.0.0-beta.4",
"clap 3.0.13",
"dirs",
"flate2",
"heck",
"heck 0.3.3",
"pathdiff",
"rand 0.7.3",
"reqwest",
@ -240,7 +240,7 @@ version = "0.20.1"
dependencies = [
"anyhow",
"bs58 0.3.1",
"heck",
"heck 0.3.3",
"proc-macro2 1.0.32",
"proc-macro2-diagnostics",
"quote 1.0.10",
@ -666,9 +666,9 @@ dependencies = [
[[package]]
name = "clap"
version = "3.0.0-beta.4"
version = "3.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcd70aa5597dbc42f7217a543f9ef2768b2ef823ba29036072d30e1d88e98406"
checksum = "08799f92c961c7a1cf0cc398a9073da99e21ce388b46372c37f3191f2f3eed3e"
dependencies = [
"atty",
"bitflags",
@ -679,16 +679,15 @@ dependencies = [
"strsim 0.10.0",
"termcolor",
"textwrap 0.14.2",
"vec_map",
]
[[package]]
name = "clap_derive"
version = "3.0.0-beta.4"
version = "3.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b5bb0d655624a0b8770d1c178fb8ffcb1f91cc722cb08f451e3dc72465421ac"
checksum = "0fd2078197a22f338bd4fbf7d6387eb6f0d6a3c69e6cbc09f5c93e97321fd92a"
dependencies = [
"heck",
"heck 0.4.0",
"proc-macro-error",
"proc-macro2 1.0.32",
"quote 1.0.10",
@ -1472,6 +1471,12 @@ dependencies = [
"unicode-segmentation",
]
[[package]]
name = "heck"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
[[package]]
name = "hermit-abi"
version = "0.1.19"
@ -2121,9 +2126,12 @@ dependencies = [
[[package]]
name = "os_str_bytes"
version = "3.1.0"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6acbef58a60fe69ab50510a55bc8cdd4d6cf2283d27ad338f54cb52747a9cf2d"
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
dependencies = [
"memchr",
]
[[package]]
name = "ouroboros"
@ -3721,9 +3729,6 @@ name = "textwrap"
version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80"
dependencies = [
"unicode-width",
]
[[package]]
name = "thiserror"

View File

@ -13,7 +13,7 @@ dev = []
default = []
[dependencies]
clap = "3.0.0-beta.1"
clap = { version = "3.0.13", features = ["derive"] }
anyhow = "1.0.32"
syn = { version = "1.0.60", features = ["full", "extra-traits"] }
anchor-lang = { path = "../lang" }

View File

@ -1,6 +1,6 @@
use anchor_cli::Opts;
use anyhow::Result;
use clap::Clap;
use clap::Parser;
fn main() -> Result<()> {
anchor_cli::entry(Opts::parse())

View File

@ -1,7 +1,7 @@
use anchor_client::Cluster;
use anchor_syn::idl::Idl;
use anyhow::{anyhow, Error, Result};
use clap::{ArgEnum, Clap};
use clap::{ArgEnum, Parser};
use heck::SnakeCase;
use serde::{Deserialize, Serialize};
use solana_sdk::pubkey::Pubkey;
@ -15,7 +15,7 @@ use std::path::Path;
use std::path::PathBuf;
use std::str::FromStr;
#[derive(Default, Debug, Clap)]
#[derive(Default, Debug, Parser)]
pub struct ConfigOverride {
/// Cluster override.
#[clap(global = true, long = "provider.cluster")]
@ -294,7 +294,7 @@ pub struct WorkspaceConfig {
pub types: String,
}
#[derive(ArgEnum, Clap, Clone, PartialEq, Debug)]
#[derive(ArgEnum, Parser, Clone, PartialEq, Debug)]
pub enum BootstrapMode {
None,
Debian,

View File

@ -7,7 +7,7 @@ use anchor_lang::idl::{IdlAccount, IdlInstruction};
use anchor_lang::{AccountDeserialize, AnchorDeserialize, AnchorSerialize};
use anchor_syn::idl::Idl;
use anyhow::{anyhow, Context, Result};
use clap::Clap;
use clap::Parser;
use flate2::read::GzDecoder;
use flate2::read::ZlibDecoder;
use flate2::write::{GzEncoder, ZlibEncoder};
@ -48,7 +48,7 @@ pub mod template;
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub const DOCKER_BUILDER_VERSION: &str = VERSION;
#[derive(Debug, Clap)]
#[derive(Debug, Parser)]
#[clap(version = VERSION)]
pub struct Opts {
#[clap(flatten)]
@ -57,7 +57,7 @@ pub struct Opts {
pub command: Command,
}
#[derive(Debug, Clap)]
#[derive(Debug, Parser)]
pub enum Command {
/// Initializes a workspace.
Init {
@ -261,12 +261,12 @@ pub enum Command {
},
}
#[derive(Debug, Clap)]
#[derive(Debug, Parser)]
pub enum KeysCommand {
List,
}
#[derive(Debug, Clap)]
#[derive(Debug, Parser)]
pub enum IdlCommand {
/// Initializes a program's IDL account. Can only be run once.
Init {
@ -341,7 +341,7 @@ pub enum IdlCommand {
},
}
#[derive(Debug, Clap)]
#[derive(Debug, Parser)]
pub enum ClusterCommand {
/// Prints common cluster urls.
List,