From 350b3039ea0bc88c830bb3b4003af02b1000fd48 Mon Sep 17 00:00:00 2001 From: Daniel Mueller Date: Sun, 6 Jan 2019 16:05:36 -0800 Subject: Auto generate argument enums The argparse module we use for parsing events expects an enum in order to convey what subcommand has been supplied as an argument. Such an enum also needs to implement str::FromStr and, preferably, fmt::Display. Manually writing down those definitions is error-prone, tedious, and adds no value -- only lines of code. As it turns out the proper definitions can be generated with relative easy with a declarative macro, making the code much more concise. Hence, with this change we use a newly introduced macro for generating those enums. --- nitrocli/src/main.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'nitrocli/src/main.rs') diff --git a/nitrocli/src/main.rs b/nitrocli/src/main.rs index a9e31f8..9f56f75 100644 --- a/nitrocli/src/main.rs +++ b/nitrocli/src/main.rs @@ -70,6 +70,8 @@ #[macro_use] mod redefine; +#[macro_use] +mod arg_util; mod args; mod commands; -- cgit v1.2.1