Эх сурвалжийг харах

cli: Add version number to version and help commands

armaniferrante 4 жил өмнө
parent
commit
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;
 mod template;
 
 
 // Version of the docker image.
 // 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)]
 #[derive(Debug, Clap)]
+#[clap(version = VERSION)]
 pub struct Opts {
 pub struct Opts {
     #[clap(subcommand)]
     #[clap(subcommand)]
     pub command: Command,
     pub command: Command,
@@ -383,7 +385,7 @@ fn build_cwd(
 fn build_cwd_verifiable(workspace_dir: &Path) -> Result<()> {
 fn build_cwd_verifiable(workspace_dir: &Path) -> Result<()> {
     // Docker vars.
     // Docker vars.
     let container_name = "anchor-program";
     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!(
     let volume_mount = format!(
         "{}:/workdir",
         "{}:/workdir",
         workspace_dir.canonicalize()?.display().to_string()
         workspace_dir.canonicalize()?.display().to_string()