-
tl;dr Clap When passing Given extern crate clap;
use clap::Parser;
#[derive(Parser, Debug)]
#[clap(author, version, about)]
struct Args {
/// path args
#[clap(parse(from_os_str))]
paths: Vec::<std::path::PathBuf>,
/// an optional number
#[clap(short, long, default_value_t = 1)]
number1: u64,
/// an optional number
#[clap(short, long, default_value_t = 2)]
anumber2: u64,
/// an optional flag
#[clap(short, long)]
option1: bool,
}
fn main() {
let args = Args::parse();
eprintln!("{:?}", args);
} and [package]
name = "test4-clap-help"
version = "0.1.0"
edition = "2021"
[dependencies]
clap = { version = "3.1.6", features = ["derive"] } The
I would like to move How can I control the ordering of listed OPTIONS? Does the clap |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Set the #[clap(setting = clap::AppSettings::DeriveDisplayOrder)]
struct Args {
... |
Beta Was this translation helpful? Give feedback.
Set the
DeriveDisplayOrder
.