mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
option_parser: Add support for adding from a slice
Add an OptionParser::add_all method that takes a slice of option names and use that to add to the set of parameters that the parser works on. Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
@@ -148,6 +148,14 @@ impl OptionParser {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn add_all(&mut self, options: &[&str]) -> &mut Self {
|
||||||
|
for option in options {
|
||||||
|
self.add(option);
|
||||||
|
}
|
||||||
|
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
pub fn add_valueless(&mut self, option: &str) -> &mut Self {
|
pub fn add_valueless(&mut self, option: &str) -> &mut Self {
|
||||||
self.options.insert(
|
self.options.insert(
|
||||||
option.to_owned(),
|
option.to_owned(),
|
||||||
|
|||||||
Reference in New Issue
Block a user