mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-07-02 19:21:37 +00:00
*: Change structopt to native clap derive implementations (#2600)
Co-authored-by: Max Inden <mail@max-inden.de>
This commit is contained in:
@ -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,
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user