Move help text and required flag to with chain, make help text optional

This commit is contained in:
2025-11-02 01:16:17 +11:00
parent 0d9b86c767
commit 912d282d12
4 changed files with 42 additions and 41 deletions

View File

@@ -8,10 +8,10 @@ use std::process::ExitCode;
fn main() -> ExitCode {
const OPTIONS: Opts<&'static str> = Opts::new(&[
Opt::help_flag("help", &["--help"], "Show this help"),
Opt::positional("positional", "positional", "Positional argument"),
Opt::value("value", &["-v", "--value"], "string", "Value option"),
Opt::flag("flag", &["-f", "--flag"], "Flag option"),
Opt::help_flag("help", &["--help"]).help_text("Show this help"),
Opt::positional("positional", "positional").help_text("Positional argument"),
Opt::value("value", &["-v", "--value"], "string").help_text("Value option"),
Opt::flag("flag", &["-f", "--flag"]).help_text("Flag option"),
]);
let map = match OPTIONS.parse_map_easy() {