Skip to content

Commit 7ca01e6

Browse files
committed
Show version number when run without arguments
Takes the version from `git describe --tags`
1 parent c344e37 commit 7ca01e6

File tree

3 files changed

+70
-1
lines changed

3 files changed

+70
-1
lines changed

Cargo.lock

Lines changed: 64 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ regex = "1"
1313
lazy_static = "1"
1414
cow-utils = "0.1"
1515
fast-float = "0.2"
16+
git-version = "0.3"

src/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use yaml_rust::yaml::Yaml;
1313
use regex::Regex;
1414
use lazy_static::lazy_static;
1515
use cow_utils::CowUtils;
16+
use git_version::git_describe;
1617

1718
macro_rules! fatalerr {
1819
() => ({
@@ -470,7 +471,10 @@ fn main() {
470471
else if args.len() == 3 {
471472
bufread = Box::new(BufReader::new(File::open(&args[2]).unwrap_or_else(|err| fatalerr!("Error: failed to open input file '{}': {}", args[2], err))));
472473
}
473-
else { fatalerr!("Usage: {} <configfile> [xmlfile]", args[0]); }
474+
else {
475+
eprintln!("xml-to-postgres {}", git_describe!("--tags"));
476+
fatalerr!("Usage: {} <configfile> [xmlfile]", args[0]);
477+
}
474478

475479
let config = {
476480
let mut config_str = String::new();

0 commit comments

Comments
 (0)