Skip to content

Commit

Permalink
cli: clap 3.0.x (coral-xyz#1370)
Browse files Browse the repository at this point in the history
  • Loading branch information
armaniferrante authored and losman0s committed Feb 7, 2022
1 parent 19368c4 commit 3ab4210
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 26 deletions.
35 changes: 20 additions & 15 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 cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion cli/src/bin/main.rs
Original file line number Diff line number Diff line change
@@ -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())
Expand Down
6 changes: 3 additions & 3 deletions cli/src/config.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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")]
Expand Down Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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)]
Expand All @@ -57,7 +57,7 @@ pub struct Opts {
pub command: Command,
}

#[derive(Debug, Clap)]
#[derive(Debug, Parser)]
pub enum Command {
/// Initializes a workspace.
Init {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -341,7 +341,7 @@ pub enum IdlCommand {
},
}

#[derive(Debug, Clap)]
#[derive(Debug, Parser)]
pub enum ClusterCommand {
/// Prints common cluster urls.
List,
Expand Down

0 comments on commit 3ab4210

Please sign in to comment.