From 025e339ced075e3bbf9b789880b9ae9b23f7dbd6 Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Tue, 20 Oct 2020 13:03:21 -0300 Subject: [PATCH] Actions are now external to the args --- src/actions.rs | 24 ++++++++++++++++++++++++ src/args.rs | 5 +---- src/main.rs | 1 + 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 src/actions.rs diff --git a/src/actions.rs b/src/actions.rs new file mode 100644 index 0000000..6052a25 --- /dev/null +++ b/src/actions.rs @@ -0,0 +1,24 @@ +/* + NRP - Name Rust Program + Copyright (C) 2020 Julio Biason + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ + +/// List of actions available +#[derive(Debug)] +pub enum Action { + /// Generate a name from the description. + Generate(String), +} diff --git a/src/args.rs b/src/args.rs index 7c43697..af77d64 100644 --- a/src/args.rs +++ b/src/args.rs @@ -25,10 +25,7 @@ use clap::Arg; // use clap::ArgMatches; use clap::SubCommand; -#[derive(Debug)] -pub enum Action { - Generate(String), -} +use crate::actions::Action; #[derive(Debug)] pub enum ParseError { diff --git a/src/main.rs b/src/main.rs index e9c8a31..d8f54f3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,6 +16,7 @@ along with this program. If not, see . */ +mod actions; mod args; fn main() {