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