Skip to content

Commit

Permalink
Git commit in --version string
Browse files Browse the repository at this point in the history
Closes #7
  • Loading branch information
michaelsproul committed May 10, 2019
1 parent 44f5ab1 commit e912193
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
35 changes: 35 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ tera = "0.11"
structopt = "0.2"
log = "0.4.6"
env_logger = "0.6.1"
git-version = "0.3.1"
clap = "*"
10 changes: 8 additions & 2 deletions src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
use git_version::git_version;
use std::path::PathBuf;
use structopt::StructOpt;

#[derive(Debug, Clone, StructOpt)]
#[structopt(rename_all = "kebab-case")]
#[structopt(
rename_all = "kebab-case",
raw(
version = "&*Box::leak(format!(\"{}-{}\", crate_version!(), git_version!()).into_boxed_str())"
)
)]
pub struct Opts {
/// Names of the modules to build
#[structopt(long)]
Expand All @@ -11,7 +17,7 @@ pub struct Opts {
#[structopt(long)]
pub search_dirs: Vec<PathBuf>,
/// Directory to build in
#[structopt(long)]
#[structopt(long, default_value = "build")]
pub build_dir: PathBuf,
/// Top-level CakeML function to run when the program executes
#[structopt(long, default_value = "main")]
Expand Down
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#[macro_use]
extern crate log;
#[macro_use]
extern crate clap;

use self::binary_compiler::BinaryCompiler;
use self::cli::Opts;
Expand Down

0 comments on commit e912193

Please sign in to comment.