From 38b103cce04b696aa77b857f8df4b98f48221614 Mon Sep 17 00:00:00 2001 From: NerdyPepper Date: Sat, 27 Apr 2019 21:26:09 +0530 Subject: add new `base` arg --- src/main.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main.rs b/src/main.rs index b9fdbd3..7facf3e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,6 +25,7 @@ use lazy_static::lazy_static; struct Configuration { radian_mode: bool, fix: usize, + base: usize, input: String } @@ -115,6 +116,12 @@ fn parse_arguments() -> Configuration { .takes_value(true) .value_name("FIX") .help("set number of decimal places in the output")) + .arg(Arg::with_name("base") + .short("b") + .long("base") + .takes_value(true) + .value_name("RADIX") + .help("set the radix of calculation output (2, 8, 10, 16 etc.)")) .arg(Arg::with_name("INPUT") .help("optional expression string to run eva in command mode") .index(1)) @@ -134,6 +141,10 @@ fn parse_arguments() -> Configuration { .unwrap_or("10") .parse() .unwrap(), + base: config.value_of("base") + .unwrap_or("10") + .parse() + .unwrap(), input, } } -- cgit v1.2.3