From 03fac454b613662c354ffefbad9f758f1ce23259 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 25 Aug 2020 20:11:12 -0700 Subject: add --version flag --- src/main.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.rs b/src/main.rs index d1c0f02..a1e8c5b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,6 +9,8 @@ extern crate log; use es_public_proxy::{filter_request, ProxyConfig}; +const CARGO_VERSION: Option<&'static str> = option_env!("CARGO_PKG_VERSION"); + async fn upstream_req( req: Request, config: ProxyConfig, @@ -75,6 +77,10 @@ fn load_config() -> ProxyConfig { println!("{}", usage()); std::process::exit(0); } + [_, "--version"] => { + println!("es-public-proxy v{}", CARGO_VERSION.unwrap_or("UNKNOWN")); + std::process::exit(0); + } [_, "--example-config"] => { println!("{}", include_str!("../extra/example_config.toml")); std::process::exit(0); -- cgit v1.2.3