mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
option_parser: add add_all_valueless() helper
Helpful to prevent repetitions. On-behalf-of: Philipp Schuster@sap.com Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
This commit is contained in:
committed by
Rob Bradford
parent
fcfae4cc4b
commit
a56f49787c
@@ -226,6 +226,17 @@ impl OptionParser {
|
||||
self
|
||||
}
|
||||
|
||||
/// Registers multiple flag-style options that do not take a value.
|
||||
///
|
||||
/// Equivalent to calling [`add_valueless`](Self::add_valueless) for each
|
||||
/// element in the slice.
|
||||
pub fn add_all_valueless(&mut self, options: &[&str]) -> &mut Self {
|
||||
for option in options {
|
||||
self.add_valueless(option);
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
/// Returns the raw string value of an option, or `None` if the option was
|
||||
/// not set or if its value is an empty string (e.g. `key=`).
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user