Use with chaining instead of alternative constructor to override flag characters

This commit is contained in:
2025-11-01 22:32:22 +11:00
parent e496a8063d
commit bf10fbc0a4

View File

@@ -16,8 +16,10 @@ impl<ID: 'static> Opts<ID> {
pub const fn new(options: &'static[Opt<ID>]) -> Self {
Self { flag_chars: "-", options }
}
// TODO: Replace with a parser options construct
pub const fn new_flag(flag_chars: &'static str, options: &'static[Opt<ID>]) -> 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
}
}