*: Change structopt to native clap derive implementations (#2600)

Co-authored-by: Max Inden <mail@max-inden.de>
This commit is contained in:
TotalKrill
2022-04-05 21:56:44 +02:00
committed by GitHub
parent 680604f3d3
commit 90140a6eaf
11 changed files with 54 additions and 54 deletions

View File

@ -79,18 +79,18 @@
use async_std::io;
use async_std::task::spawn;
use clap::Parser;
use futures::prelude::*;
use libp2p::core::{Multiaddr, PeerId};
use libp2p::multiaddr::Protocol;
use std::error::Error;
use std::path::PathBuf;
use structopt::StructOpt;
#[async_std::main]
async fn main() -> Result<(), Box<dyn Error>> {
env_logger::init();
let opt = Opt::from_args();
let opt = Opt::parse();
let (mut network_client, mut network_events, network_event_loop) =
network::new(opt.secret_key_seed).await?;
@ -170,33 +170,33 @@ async fn main() -> Result<(), Box<dyn Error>> {
Ok(())
}
#[derive(Debug, StructOpt)]
#[structopt(name = "libp2p file sharing example")]
#[derive(Parser, Debug)]
#[clap(name = "libp2p file sharing example")]
struct Opt {
/// Fixed value to generate deterministic peer ID.
#[structopt(long)]
#[clap(long)]
secret_key_seed: Option<u8>,
#[structopt(long)]
#[clap(long)]
peer: Option<Multiaddr>,
#[structopt(long)]
#[clap(long)]
listen_address: Option<Multiaddr>,
#[structopt(subcommand)]
#[clap(subcommand)]
argument: CliArgument,
}
#[derive(Debug, StructOpt)]
#[derive(Debug, Parser)]
enum CliArgument {
Provide {
#[structopt(long)]
#[clap(long)]
path: PathBuf,
#[structopt(long)]
#[clap(long)]
name: String,
},
Get {
#[structopt(long)]
#[clap(long)]
name: String,
},
}