diff options
Diffstat (limited to 'src/config.rs')
-rw-r--r-- | src/config.rs | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/src/config.rs b/src/config.rs index afca365..78771cf 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,36 +1,9 @@ use regex::Regex; use std::num::ParseIntError; -use std::path::PathBuf; use std::process; -use structopt::StructOpt; use crate::choice::Choice; - -#[derive(Debug, StructOpt)] -#[structopt(name = "choose", about = "`choose` sections from each line of files")] -pub struct Opt { - /// Specify field separator other than whitespace - #[structopt(short, long)] - pub field_separator: Option<String>, - - /// Use exclusive ranges, similar to array slicing in many programming languages - #[structopt(short = "x", long)] - pub exclusive: bool, - - /// Activate debug mode - #[structopt(short, long)] - pub debug: bool, - - /// Input file - #[structopt(short, long, parse(from_os_str))] - pub input: Option<PathBuf>, - - /// Fields to print. Either x, x:, :y, or x:y, where x and y are integers, colons indicate a - /// range, and an empty field on either side of the colon continues to the beginning or end of - /// the line. - #[structopt(required = true, min_values = 1, parse(try_from_str = Config::parse_choice))] - pub choice: Vec<Choice>, -} +use crate::opt::Opt; lazy_static! { static ref PARSE_CHOICE_RE: Regex = Regex::new(r"^(\d*):(\d*)$").unwrap(); |