Skip to content

Commit

Permalink
Set structopt version using git tag
Browse files Browse the repository at this point in the history
  • Loading branch information
nbigaouette committed Apr 16, 2019
1 parent 15c3399 commit 1e1b12a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Cargo.lock

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

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "pycors"
version = "0.1.9"
authors = ["Nicolas Bigaouette <[email protected]>"]
build = "build.rs"
edition = "2018"

[dependencies]
Expand All @@ -25,4 +26,7 @@ tar = "0.4"
terminal_size = "0.1"
url = "1.7"
shlex = "0.1"
which = "2.0"
which = "2.0"

[build-dependencies]
git-version = "0.2"
3 changes: 3 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
git_version::set_env();
}
3 changes: 3 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ use crate::{
pub type Result<T> = std::result::Result<T, failure::Error>;

pub const EXECUTABLE_NAME: &str = "pycors";
// This environment variable is set in `build.rs` by the `git-version` crate.
const GIT_VERSION: &str = env!("VERSION");

/// Control which Python toolchain to use on a directory basis.
#[derive(StructOpt, Debug)]
#[structopt(raw(version = "GIT_VERSION"))]
struct Opt {
#[structopt(subcommand)]
subcommand: Option<commands::Command>,
Expand Down

0 comments on commit 1e1b12a

Please sign in to comment.