Implement version number

This commit is contained in:
RunasSudo 2021-05-28 22:37:07 +10:00
parent 637884cdbf
commit 5731d71b07
No known key found for this signature in database
GPG Key ID: 7234E476BF21C61A
3 changed files with 35 additions and 0 deletions

29
Cargo.lock generated
View File

@ -47,6 +47,28 @@ dependencies = [
"syn",
]
[[package]]
name = "git-version"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94918e83f1e01dedc2e361d00ce9487b14c58c7f40bab148026fa39d42cb41e2"
dependencies = [
"git-version-macro",
"proc-macro-hack",
]
[[package]]
name = "git-version-macro"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34a97a52fdee1870a34fa6e4b77570cba531b27d1838874fef4429a791a3d657"
dependencies = [
"proc-macro-hack",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "gmp-mpfr-sys"
version = "1.4.5"
@ -108,6 +130,7 @@ name = "opentally"
version = "0.1.0"
dependencies = [
"clap",
"git-version",
"num-traits",
"rug",
]
@ -142,6 +165,12 @@ dependencies = [
"version_check",
]
[[package]]
name = "proc-macro-hack"
version = "0.5.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
[[package]]
name = "proc-macro2"
version = "1.0.27"

View File

@ -5,6 +5,7 @@ authors = ["Lee Yingtong Li <runassudo@yingtongli.me>"]
edition = "2018"
[dependencies]
git-version = "0.3.4"
num-traits = "0.2"
[dependencies.rug]

View File

@ -23,11 +23,16 @@ use crate::election::{CandidateState, CountState, CountStateOrRef, Election, Sta
use crate::numbers::{Number, NumType};
use clap::Clap;
use git_version::git_version;
use std::fs::File;
use std::io::{self, BufRead};
const VERSION: &str = git_version!(args=["--always", "--dirty=-dev"], fallback="unknown");
/// Open-source election vote counting
#[derive(Clap)]
#[clap(name="OpenTally", version=VERSION)]
struct Opts {
#[clap(subcommand)]
command: Command,