From f158e20713cce2a9b167e31887d074843092d648 Mon Sep 17 00:00:00 2001 From: Simon Karan Date: Mon, 11 Aug 2025 13:12:33 +0200 Subject: [PATCH] Add --version flag to CLI Add support for --version (-V) flag to display the current version. The version is now available on-demand via CLI flag in addition to being displayed during server startup. Updates: - Add version attribute to CLI struct using clap's built-in version support - Update README.md to document the new --version flag and usage Resolves the common CLI expectation of having a version flag. --- README.md | 3 ++- src/cli.rs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fcfe3b8..d851948 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,8 @@ Commands: help Print this message or the help of the given subcommand(s) Options: - -h, --help Print help + -h, --help Print help + -V, --version Print version ``` ### Using the stdio protocol diff --git a/src/cli.rs b/src/cli.rs index fee28a3..02219ea 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -24,6 +24,7 @@ use std::path::PathBuf; /// Elastic MCP server #[derive(Debug, Parser)] +#[command(version)] pub struct Cli { /// Container mode: change default http address, rewrite localhost to the host's address #[clap(global=true, long, env = "CONTAINER_MODE")]