mirror of
https://github.com/ktims/rs-aggregate.git
synced 2024-11-15 23:27:18 -08:00
Switch to doc comments instead of macro params for cli help
This commit is contained in:
parent
56ad01e74c
commit
a75fdadcf8
35
src/main.rs
35
src/main.rs
@ -1,44 +1,33 @@
|
|||||||
extern crate ipnet;
|
extern crate ipnet;
|
||||||
|
|
||||||
use std::{process::exit, io};
|
use std::{io, process::exit};
|
||||||
|
|
||||||
mod iputils;
|
mod iputils;
|
||||||
use iputils::{IpBothRange, IpOrNet, PrefixlenPair};
|
use iputils::{IpBothRange, IpOrNet, PrefixlenPair};
|
||||||
|
|
||||||
use clio::*;
|
use clio::*;
|
||||||
use std::io::{Write, BufRead};
|
use std::io::{BufRead, Write};
|
||||||
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
|
||||||
const WRITER_BUFSIZE: usize = 32 * 1024;
|
const WRITER_BUFSIZE: usize = 1 * 1024;
|
||||||
|
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
#[command(author, version, about, long_about=None)]
|
#[command(author, version, about)]
|
||||||
struct Args {
|
struct Args {
|
||||||
#[clap(value_parser, default_value = "-")]
|
#[clap(value_parser, default_value = "-")]
|
||||||
input: Vec<Input>,
|
input: Vec<Input>,
|
||||||
#[structopt(
|
/// Maximum prefix length for prefixes read. Single value applies to IPv4 and IPv6, comma-separated [IPv4],[IPv6].
|
||||||
short,
|
#[structopt(short, long, default_value = "32,128")]
|
||||||
long,
|
|
||||||
default_value = "32,128",
|
|
||||||
help = "Maximum prefix length for prefixes read. Single value applies to IPv4 and IPv6, comma-separated [IPv4],[IPv6]."
|
|
||||||
)]
|
|
||||||
max_prefixlen: PrefixlenPair,
|
max_prefixlen: PrefixlenPair,
|
||||||
#[arg(short, long, help = "truncate IP/mask to network/mask (else ignore)")]
|
/// Truncate IP/mask to network/mask (else ignore)
|
||||||
|
#[arg(short, long)]
|
||||||
truncate: bool,
|
truncate: bool,
|
||||||
#[arg(
|
/// Only output IPv4 prefixes
|
||||||
id = "4",
|
#[arg(id = "4", short, conflicts_with("6"))]
|
||||||
short,
|
|
||||||
help = "Only output IPv4 prefixes",
|
|
||||||
conflicts_with("6")
|
|
||||||
)]
|
|
||||||
only_v4: bool,
|
only_v4: bool,
|
||||||
#[arg(
|
/// Only output IPv6 prefixes
|
||||||
id = "6",
|
#[arg(id = "6", short, conflicts_with("4"))]
|
||||||
short,
|
|
||||||
help = "Only output IPv6 prefixes",
|
|
||||||
conflicts_with("4")
|
|
||||||
)]
|
|
||||||
only_v6: bool,
|
only_v6: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user