From 6e4dd1575b3f0a147ada0f37477e36f51ab04277 Mon Sep 17 00:00:00 2001 From: Otto Sabart Date: Sun, 7 Nov 2021 21:06:52 +0100 Subject: [PATCH] Add version command line argument --- internal/config_specification.toml | 4 ++++ src/config.rs | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/internal/config_specification.toml b/internal/config_specification.toml index 27cba14..91987de 100644 --- a/internal/config_specification.toml +++ b/internal/config_specification.toml @@ -108,6 +108,10 @@ doc = "Exit after the initial sync is over (don't start Electrum server)." name = "cache_merkle_proofs" doc = "Cache merkle proofs on subscription (if disabled, they are computed on demand)." +[[switch]] +name = "version" +doc = "Print out the program version." + [[param]] name = "index_lookup_limit" type = "usize" diff --git a/src/config.rs b/src/config.rs index 3b2d316..78db4af 100644 --- a/src/config.rs +++ b/src/config.rs @@ -308,6 +308,11 @@ impl Config { std::process::exit(1); } + if config.version { + println!("v{}", ELECTRS_VERSION); + std::process::exit(0); + } + let config = Config { network: config.network, db_path: config.db_dir,