From 9bc3ddb822bfd6fdadeb92f3a00e09ef3481c9f6 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 26 Feb 2019 12:40:51 +0100 Subject: [PATCH] src/cli/command.rs: improve generate_usage_str correctly format positional array arguments ({}). --- src/cli/command.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cli/command.rs b/src/cli/command.rs index 80552f5b..e921e134 100644 --- a/src/cli/command.rs +++ b/src/cli/command.rs @@ -125,10 +125,14 @@ fn generate_usage_str( for positional_arg in arg_param { match properties.get(positional_arg) { - Some((optional, _schema)) => { + Some((optional, schema)) => { args.push(' '); + + let is_array = if let Schema::Array(_) = schema.as_ref() { true } else { false }; if *optional { args.push('['); } + if is_array { args.push('{'); } args.push('<'); args.push_str(positional_arg); args.push('>'); + if is_array { args.push('}'); } if *optional { args.push(']'); } done_hash.insert(positional_arg);