client, server: make clap's helptext a bit friendlier

pull/96/head
Jake McGinty 2021-05-26 14:23:02 +09:00
parent ec210f9468
commit 9524019c55
2 changed files with 8 additions and 7 deletions

View File

@ -14,7 +14,7 @@ use std::{
thread,
time::{Duration, SystemTime},
};
use structopt::StructOpt;
use structopt::{clap::AppSettings, StructOpt};
use wgctrl::{Device, DeviceUpdate, InterfaceName, PeerConfigBuilder, PeerInfo};
mod data_store;
@ -37,13 +37,14 @@ macro_rules! println_pad {
}
#[derive(Debug, StructOpt)]
#[structopt(name = "innernet", about)]
#[structopt(name = "innernet", about, global_settings(&[AppSettings::ColoredHelp, AppSettings::DeriveDisplayOrder, AppSettings::VersionlessSubcommands, AppSettings::UnifiedHelpMessage]))]
struct Opts {
#[structopt(subcommand)]
command: Option<Command>,
#[structopt(short, parse(from_occurrences))]
verbosity: u64,
/// Verbose output, use -vv for even higher verbositude.
#[structopt(short, long, parse(from_occurrences))]
verbose: u64,
#[structopt(flatten)]
network: NetworkOpt,
@ -981,7 +982,7 @@ fn print_peer(peer: &PeerState, short: bool, level: usize) {
fn main() {
let opt = Opts::from_args();
util::init_logger(opt.verbosity);
util::init_logger(opt.verbose);
if let Err(e) = run(opt) {
println!();

View File

@ -22,7 +22,7 @@ use std::{
sync::Arc,
time::Duration,
};
use structopt::StructOpt;
use structopt::{clap::AppSettings, StructOpt};
use subtle::ConstantTimeEq;
use wgctrl::{Backend, Device, DeviceUpdate, InterfaceName, Key, PeerConfigBuilder};
@ -44,7 +44,7 @@ pub use shared::{Association, AssociationContents};
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
#[derive(Debug, StructOpt)]
#[structopt(name = "innernet-server", about)]
#[structopt(name = "innernet-server", about, global_settings(&[AppSettings::ColoredHelp, AppSettings::DeriveDisplayOrder, AppSettings::VersionlessSubcommands, AppSettings::UnifiedHelpMessage]))]
struct Opt {
#[structopt(subcommand)]
command: Command,