Add --version flag
This commit is contained in:
parent
ef4738061e
commit
cedc70af3a
@ -1,6 +1,7 @@
|
||||
## Next
|
||||
- Freak out instead of ignoring unexpected arguments
|
||||
- Add support for non-US "metre" and "litre" spellings
|
||||
- Add `--version` flag
|
||||
- Freak out instead of ignoring unexpected arguments
|
||||
- Fix decimeter parsed as centimeter
|
||||
|
||||
## 1.5.1 - 2021 Jun 10
|
||||
|
||||
@ -2,6 +2,8 @@ use cpc::eval;
|
||||
use cpc::units::Unit;
|
||||
use std::process::exit;
|
||||
|
||||
const VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
/// CLI interface
|
||||
fn main() {
|
||||
use std::env;
|
||||
@ -12,6 +14,10 @@ fn main() {
|
||||
for arg in args {
|
||||
match arg.as_str() {
|
||||
"-v" | "--verbose" => verbose = true,
|
||||
"--version" => {
|
||||
println!("{}", VERSION);
|
||||
exit(0);
|
||||
},
|
||||
_ => {
|
||||
if expression_opt == None {
|
||||
expression_opt = Some(arg);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user