diff options
author | NerdyPepper <[email protected]> | 2019-04-27 16:56:09 +0100 |
---|---|---|
committer | NerdyPepper <[email protected]> | 2019-04-27 16:56:09 +0100 |
commit | 38b103cce04b696aa77b857f8df4b98f48221614 (patch) | |
tree | a1023488295ad604f4602a358e770c3494a4d715 /src | |
parent | fb38a1f6fd3caec768b782e0f24cfe7619cb4b74 (diff) |
add new `base` arg
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 11 |
1 files changed, 11 insertions, 0 deletions
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; | |||
25 | struct Configuration { | 25 | struct Configuration { |
26 | radian_mode: bool, | 26 | radian_mode: bool, |
27 | fix: usize, | 27 | fix: usize, |
28 | base: usize, | ||
28 | input: String | 29 | input: String |
29 | } | 30 | } |
30 | 31 | ||
@@ -115,6 +116,12 @@ fn parse_arguments() -> Configuration { | |||
115 | .takes_value(true) | 116 | .takes_value(true) |
116 | .value_name("FIX") | 117 | .value_name("FIX") |
117 | .help("set number of decimal places in the output")) | 118 | .help("set number of decimal places in the output")) |
119 | .arg(Arg::with_name("base") | ||
120 | .short("b") | ||
121 | .long("base") | ||
122 | .takes_value(true) | ||
123 | .value_name("RADIX") | ||
124 | .help("set the radix of calculation output (2, 8, 10, 16 etc.)")) | ||
118 | .arg(Arg::with_name("INPUT") | 125 | .arg(Arg::with_name("INPUT") |
119 | .help("optional expression string to run eva in command mode") | 126 | .help("optional expression string to run eva in command mode") |
120 | .index(1)) | 127 | .index(1)) |
@@ -134,6 +141,10 @@ fn parse_arguments() -> Configuration { | |||
134 | .unwrap_or("10") | 141 | .unwrap_or("10") |
135 | .parse() | 142 | .parse() |
136 | .unwrap(), | 143 | .unwrap(), |
144 | base: config.value_of("base") | ||
145 | .unwrap_or("10") | ||
146 | .parse() | ||
147 | .unwrap(), | ||
137 | input, | 148 | input, |
138 | } | 149 | } |
139 | } | 150 | } |