From d137415a69007a90569ebbf38a92424fba60b997 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Tue, 18 Dec 2018 00:39:15 +0100 Subject: Add argparse 0.2.2 as a dependency This patch adds the crate rust-argparse [0] in version 0.2.2 as a dependency, as discussed in issue #4. [0] https://github.com/tailhook/rust-argparse Import subrepo argparse/:argparse at 0de60a5e6d9ee1a3570d6089afd3ccd6ed7480c5 --- argparse/src/action.rs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 argparse/src/action.rs (limited to 'argparse/src/action.rs') diff --git a/argparse/src/action.rs b/argparse/src/action.rs new file mode 100644 index 0000000..c3a0aff --- /dev/null +++ b/argparse/src/action.rs @@ -0,0 +1,33 @@ +use std::cell::RefCell; +use std::rc::Rc; + +pub enum ParseResult { + Parsed, + Help, + Exit, + Error(String), +} + + +pub enum Action<'a> { + Flag(Box), + Single(Box), + Push(Box), + Many(Box), +} + +pub trait TypedAction { + fn bind<'x>(&self, Rc>) -> Action<'x>; +} + +pub trait IFlagAction { + fn parse_flag(&self) -> ParseResult; +} + +pub trait IArgAction { + fn parse_arg(&self, arg: &str) -> ParseResult; +} + +pub trait IArgsAction { + fn parse_args(&self, args: &[&str]) -> ParseResult; +} -- cgit v1.2.1