浏览代码

cli: Add version number to version and help commands

armaniferrante 4 年之前
父节点
当前提交
3eb1ee96c7
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      cli/src/main.rs

+ 4 - 2
cli/src/main.rs

@@ -32,9 +32,11 @@ mod config;
 mod template;
 
 // Version of the docker image.
-const DOCKER_BUILDER_VER: &str = env!("CARGO_PKG_VERSION");
+const VERSION: &str = env!("CARGO_PKG_VERSION");
+const DOCKER_BUILDER_VERSION: &str = VERSION;
 
 #[derive(Debug, Clap)]
+#[clap(version = VERSION)]
 pub struct Opts {
     #[clap(subcommand)]
     pub command: Command,
@@ -383,7 +385,7 @@ fn build_cwd(
 fn build_cwd_verifiable(workspace_dir: &Path) -> Result<()> {
     // Docker vars.
     let container_name = "anchor-program";
-    let image_name = format!("projectserum/build:v{}", DOCKER_BUILDER_VER);
+    let image_name = format!("projectserum/build:v{}", DOCKER_BUILDER_VERSION);
     let volume_mount = format!(
         "{}:/workdir",
         workspace_dir.canonicalize()?.display().to_string()