From 38555b5072e11430facae870d42a3452980af5a5 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Wed, 12 Dec 2018 08:33:50 +0100 Subject: [PATCH] implement completion for enums --- src/cli/command.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/cli/command.rs b/src/cli/command.rs index a7d31b1d..f4fc977d 100644 --- a/src/cli/command.rs +++ b/src/cli/command.rs @@ -85,7 +85,17 @@ fn handle_nested_command(def: &CliCommandMap, mut args: Vec) -> Result<( } 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!(""); }