aboutsummaryrefslogtreecommitdiff
path: root/nitrocli/src/arg_util.rs
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2019-01-15 18:07:08 -0800
committerDaniel Mueller <deso@posteo.net>2019-01-15 18:07:08 -0800
commitca71373ce37e6377d199ac285df999230049ab8e (patch)
treee40849d803126db8826bc314b19510645e6d7b69 /nitrocli/src/arg_util.rs
parent984f5fadd1bfcd0184af8bddc4973acfe8affb64 (diff)
downloadnitrocli-ca71373ce37e6377d199ac285df999230049ab8e.tar.gz
nitrocli-ca71373ce37e6377d199ac285df999230049ab8e.tar.bz2
Auto-generate help text for Option-based arguments
The previous change to properly format the help text for optional arguments left one thing out: parameters that are based on an Option as opposed to an enum. The problem with those is that we cannot simply ask the value (i.e., the Option) for all the variants of the inner type. Instead, we have to reference the actual type of the inner enum in order to retrieve all its possible variants.
Diffstat (limited to 'nitrocli/src/arg_util.rs')
-rw-r--r--nitrocli/src/arg_util.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/nitrocli/src/arg_util.rs b/nitrocli/src/arg_util.rs
index b1ced25..9fa254b 100644
--- a/nitrocli/src/arg_util.rs
+++ b/nitrocli/src/arg_util.rs
@@ -109,8 +109,10 @@ macro_rules! Enum {
/// replaced with a generated version of the enum's variants.
macro_rules! fmt_enum {
( $enm:ident ) => {{
- $enm
- .all()
+ fmt_enum!($enm.all())
+ }};
+ ( $all:expr ) => {{
+ $all
.iter()
.map(::std::convert::AsRef::as_ref)
.collect::<::std::vec::Vec<_>>()