forked from proxmox-mirrors/proxmox
api/cli/completion.rs: implement completion for lists of strings
This commit is contained in:
parent
6fba9bf0bf
commit
48f8e6070d
@ -36,11 +36,8 @@ fn get_property_completion(
|
|||||||
return completions;
|
return completions;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Schema::String(StringSchema {
|
match schema {
|
||||||
format: Some(format),
|
Schema::String(StringSchema { format: Some(format), .. }) => {
|
||||||
..
|
|
||||||
}) = schema
|
|
||||||
{
|
|
||||||
if let ApiStringFormat::Enum(list) = format {
|
if let ApiStringFormat::Enum(list) = format {
|
||||||
let mut completions = Vec::new();
|
let mut completions = Vec::new();
|
||||||
for value in list.iter() {
|
for value in list.iter() {
|
||||||
@ -51,8 +48,7 @@ fn get_property_completion(
|
|||||||
return completions;
|
return completions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Schema::Boolean(BooleanSchema { .. }) => {
|
||||||
if let Schema::Boolean(BooleanSchema { .. }) = schema {
|
|
||||||
let mut completions = Vec::new();
|
let mut completions = Vec::new();
|
||||||
let mut lowercase_arg = arg.to_string();
|
let mut lowercase_arg = arg.to_string();
|
||||||
lowercase_arg.make_ascii_lowercase();
|
lowercase_arg.make_ascii_lowercase();
|
||||||
@ -63,6 +59,13 @@ fn get_property_completion(
|
|||||||
}
|
}
|
||||||
return completions;
|
return completions;
|
||||||
}
|
}
|
||||||
|
Schema::Array(ArraySchema { items, .. }) => {
|
||||||
|
if let Schema::String(_) = items {
|
||||||
|
return get_property_completion(&items, name, completion_functions, arg, param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
|
||||||
Vec::new()
|
Vec::new()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user