diff --git a/Cargo.lock b/Cargo.lock index be5a14b8730..864af20728d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -633,6 +633,26 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f6b64db6932c7e49332728e3a6bd82c6b7e16016607d20923b537c3bc4c0d5f" +[[package]] +name = "const_format" +version = "0.2.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7309d9b4d3d2c0641e018d449232f2e28f1b22933c137f157d3dbc14228b8c0e" +dependencies = [ + "const_format_proc_macros", +] + +[[package]] +name = "const_format_proc_macros" +version = "0.2.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f47bf7270cf70d370f8f98c1abb6d2d4cf60a6845d30e05bfb90c6568650" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + [[package]] name = "core-foundation" version = "0.9.3" @@ -1256,6 +1276,28 @@ version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dec7af912d60cdbd3677c1af9352ebae6fb8394d165568a2234df0fa00f87793" +[[package]] +name = "git-version" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6b0decc02f4636b9ccad390dcbe77b722a77efedfa393caf8379a51d5c61899" +dependencies = [ + "git-version-macro", + "proc-macro-hack", +] + +[[package]] +name = "git-version-macro" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe69f1cbdb6e28af2bac214e943b99ce8a0a06b447d15d3e61161b0423139f3f" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "glob" version = "0.3.1" @@ -1692,8 +1734,10 @@ dependencies = [ "barretenberg_wasm", "cfg-if 1.0.0", "clap 2.34.0", + "const_format", "dirs 4.0.0", "fm", + "git-version", "hex", "iter-extended", "marlin_arkworks_backend", @@ -2070,6 +2114,12 @@ dependencies = [ "version_check", ] +[[package]] +name = "proc-macro-hack" +version = "0.5.20+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" + [[package]] name = "proc-macro2" version = "1.0.50" diff --git a/crates/nargo/Cargo.toml b/crates/nargo/Cargo.toml index ea018cd7ead..78c470a704b 100644 --- a/crates/nargo/Cargo.toml +++ b/crates/nargo/Cargo.toml @@ -25,6 +25,8 @@ serde_derive.workspace = true thiserror.workspace = true serde = "1.0.123" clap = "2.33.3" +const_format = "0.2.30" +git-version = "0.3.5" hex = "0.4.2" termcolor = "1.1.2" tempdir = "0.3.7" diff --git a/crates/nargo/src/cli/mod.rs b/crates/nargo/src/cli/mod.rs index 2faf739585e..01c42817a53 100644 --- a/crates/nargo/src/cli/mod.rs +++ b/crates/nargo/src/cli/mod.rs @@ -1,5 +1,7 @@ pub use check_cmd::check_from_path; use clap::{App, AppSettings, Arg}; +use const_format::formatcp; +use git_version::git_version; use noirc_abi::{ input_parser::{Format, InputValue}, Abi, @@ -25,6 +27,9 @@ mod new_cmd; mod prove_cmd; mod verify_cmd; +const SHORT_GIT_HASH: &str = git_version!(prefix = "git:"); +const VERSION_STRING: &str = formatcp!("{} ({})", env!("CARGO_PKG_VERSION"), SHORT_GIT_HASH); + pub fn start_cli() { let allow_warnings = Arg::with_name("allow-warnings") .long("allow-warnings") @@ -36,7 +41,7 @@ pub fn start_cli() { let matches = App::new("nargo") .about("Noir's package manager") - .version("0.1") + .version(VERSION_STRING) .author("Kevaundray Wedderburn ") .subcommand( App::new("check")