From 84d2eac2fc9224a4a2a8aec04df14d20ada1f35d Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Mon, 26 Dec 2022 14:47:13 -0500 Subject: [PATCH] cli: output full version (#170057) Fixes #169635 --- cli/src/commands/args.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cli/src/commands/args.rs b/cli/src/commands/args.rs index 21ae6d10aec..6f316b51b32 100644 --- a/cli/src/commands/args.rs +++ b/cli/src/commands/args.rs @@ -25,12 +25,22 @@ To read output from another program, append '-' (e.g. 'echo Hello World | ", {all-args}" ); +const COMMIT_IN_VERSION: &str = match constants::VSCODE_CLI_COMMIT { + Some(c) => c, + None => "unknown", +}; +const NUMBER_IN_VERSION: &str = match constants::VSCODE_CLI_VERSION { + Some(c) => c, + None => "dev", +}; +const VERSION: &str = concatcp!(NUMBER_IN_VERSION, " (commit ", COMMIT_IN_VERSION, ")"); + #[derive(Parser, Debug, Default)] #[clap( help_template = TEMPLATE, long_about = None, name = CLI_NAME, - version = match constants::VSCODE_CLI_VERSION { Some(v) => v, None => "dev" }, + version = VERSION, )] pub struct IntegratedCli { #[clap(flatten)] @@ -62,7 +72,7 @@ pub struct CliCore { help_template = TEMPLATE, long_about = None, name = CLI_NAME, - version = match constants::VSCODE_CLI_VERSION { Some(v) => v, None => "dev" }, + version = VERSION, )] pub struct StandaloneCli { #[clap(flatten)]