From bf10fbc0a45be92026857929eaf5f8d7a9a103f6 Mon Sep 17 00:00:00 2001 From: a dinosaur Date: Sat, 1 Nov 2025 22:32:22 +1100 Subject: [PATCH] Use with chaining instead of alternative constructor to override flag characters --- src/options.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/options.rs b/src/options.rs index 34ab655..1e64faf 100644 --- a/src/options.rs +++ b/src/options.rs @@ -16,8 +16,10 @@ impl Opts { pub const fn new(options: &'static[Opt]) -> Self { Self { flag_chars: "-", options } } - // TODO: Replace with a parser options construct - pub const fn new_flag(flag_chars: &'static str, options: &'static[Opt]) -> Self { - Self { flag_chars, options } + + /// Set the recognised flag/option characters. + pub const fn with_flag_chars(mut self, flag_chars: &'static str) -> Self { + self.flag_chars = flag_chars; + self } }