implement completion for enums

This commit is contained in:
Dietmar Maurer 2018-12-12 08:33:50 +01:00
parent 2f0258959b
commit 38555b5072
1 changed files with 11 additions and 1 deletions

View File

@ -85,7 +85,17 @@ fn handle_nested_command(def: &CliCommandMap, mut args: Vec<String>) -> Result<(
} }
fn print_property_completion(schema: &Schema, arg: &str) { fn print_property_completion(schema: &Schema, arg: &str) {
// fixme // fixme: implement completion functions
if let Schema::String(StringSchema { format: Some(format), ..} ) = schema {
if let ApiStringFormat::Enum(list) = format.as_ref() {
for value in list {
if value.starts_with(arg) {
println!("{}", value);
}
}
return;
}
}
println!(""); println!("");
} }