From 5afc472ea217c18a6f273e2a3fce73ffe3481cbb Mon Sep 17 00:00:00 2001 From: idky137 Date: Tue, 28 Jan 2025 13:55:25 +0000 Subject: [PATCH] added --version command --- Cargo.lock | 14 +++++++------- integration-tests/Cargo.toml | 6 ++++-- zaino-fetch/Cargo.toml | 6 ++++-- zaino-proto/Cargo.toml | 6 ++++-- zaino-serve/Cargo.toml | 6 ++++-- zaino-state/Cargo.toml | 7 ++++--- zaino-testutils/Cargo.toml | 6 ++++-- zainod/Cargo.toml | 6 ++++-- zainod/src/main.rs | 14 +++++++++++--- 9 files changed, 46 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a92e8a33..5386fe4c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1961,7 +1961,7 @@ dependencies = [ [[package]] name = "integration-tests" -version = "0.0.0" +version = "0.1.1" dependencies = [ "tokio", "tracing-subscriber", @@ -5221,7 +5221,7 @@ dependencies = [ [[package]] name = "zaino-fetch" -version = "0.0.0" +version = "0.1.1" dependencies = [ "base64 0.22.1", "byteorder", @@ -5247,7 +5247,7 @@ dependencies = [ [[package]] name = "zaino-proto" -version = "0.0.0" +version = "0.1.1" dependencies = [ "prost", "tonic", @@ -5257,7 +5257,7 @@ dependencies = [ [[package]] name = "zaino-serve" -version = "0.0.0" +version = "0.1.1" dependencies = [ "async-stream", "crossbeam-channel", @@ -5280,7 +5280,7 @@ dependencies = [ [[package]] name = "zaino-state" -version = "0.0.0" +version = "0.1.1" dependencies = [ "async-trait", "chrono", @@ -5314,7 +5314,7 @@ dependencies = [ [[package]] name = "zaino-testutils" -version = "0.0.0" +version = "0.1.1" dependencies = [ "ctrlc", "http", @@ -5334,7 +5334,7 @@ dependencies = [ [[package]] name = "zainod" -version = "0.0.0" +version = "0.1.1" dependencies = [ "clap", "ctrlc", diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index a76c0bca..77737c8d 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -1,10 +1,12 @@ [package] name = "integration-tests" description = "Crate containing Zaino's integration-tests." -edition = { workspace = true } authors = { workspace = true } -license = { workspace = true } repository = { workspace = true } +homepage = { workspace = true } +edition = { workspace = true } +license = { workspace = true } +version = { workspace = true } [dependencies] # Test utility diff --git a/zaino-fetch/Cargo.toml b/zaino-fetch/Cargo.toml index 6fdf473e..57c3c83d 100644 --- a/zaino-fetch/Cargo.toml +++ b/zaino-fetch/Cargo.toml @@ -1,10 +1,12 @@ [package] name = "zaino-fetch" description = "A mempool-fetching, chain-fetching and transaction submission service that uses zebra's RPC interface." -edition = { workspace = true } authors = { workspace = true } -license = { workspace = true } repository = { workspace = true } +homepage = { workspace = true } +edition = { workspace = true } +license = { workspace = true } +version = { workspace = true } [dependencies] zaino-proto = { path = "../zaino-proto" } diff --git a/zaino-proto/Cargo.toml b/zaino-proto/Cargo.toml index e34fbcb4..1ddbcc19 100644 --- a/zaino-proto/Cargo.toml +++ b/zaino-proto/Cargo.toml @@ -1,10 +1,12 @@ [package] name = "zaino-proto" description = "Holds tonic files and build logic for the lightwallet and darkside RPCs." -edition = { workspace = true } authors = { workspace = true } -license = { workspace = true } repository = { workspace = true } +homepage = { workspace = true } +edition = { workspace = true } +license = { workspace = true } +version = { workspace = true } [dependencies] # Miscellaneous Workspace diff --git a/zaino-serve/Cargo.toml b/zaino-serve/Cargo.toml index b20a1866..a6de5a44 100644 --- a/zaino-serve/Cargo.toml +++ b/zaino-serve/Cargo.toml @@ -1,10 +1,12 @@ [package] name = "zaino-serve" description = "Crate containing Zingo's gRPC server implementation." -edition = { workspace = true } authors = { workspace = true } -license = { workspace = true } repository = { workspace = true } +homepage = { workspace = true } +edition = { workspace = true } +license = { workspace = true } +version = { workspace = true } [features] state_service = [] diff --git a/zaino-state/Cargo.toml b/zaino-state/Cargo.toml index 794f2f3c..816973e1 100644 --- a/zaino-state/Cargo.toml +++ b/zaino-state/Cargo.toml @@ -1,11 +1,12 @@ [package] name = "zaino-state" description = "A mempool and chain-fetching service built on top of zebra's ReadStateService and TrustedChainSync." -edition = { workspace = true } authors = { workspace = true } -license = { workspace = true } repository = { workspace = true } - +homepage = { workspace = true } +edition = { workspace = true } +license = { workspace = true } +version = { workspace = true } [dependencies] zaino-fetch = { path = "../zaino-fetch" } diff --git a/zaino-testutils/Cargo.toml b/zaino-testutils/Cargo.toml index 44ef330f..a33ebe56 100644 --- a/zaino-testutils/Cargo.toml +++ b/zaino-testutils/Cargo.toml @@ -1,10 +1,12 @@ [package] name = "zaino-testutils" description = "Crate containing Zaino test specific functionality." -edition = { workspace = true } authors = { workspace = true } -license = { workspace = true } repository = { workspace = true } +homepage = { workspace = true } +edition = { workspace = true } +license = { workspace = true } +version = { workspace = true } [features] # Used by zcash-local-net: diff --git a/zainod/Cargo.toml b/zainod/Cargo.toml index bf1d6484..8621f1fc 100644 --- a/zainod/Cargo.toml +++ b/zainod/Cargo.toml @@ -1,10 +1,12 @@ [package] name = "zainod" description = "Crate containing the Zaino Indexer binary." -edition = { workspace = true } authors = { workspace = true } -license = { workspace = true } repository = { workspace = true } +homepage = { workspace = true } +edition = { workspace = true } +license = { workspace = true } +version = { workspace = true } [[bin]] name = "zainod" diff --git a/zainod/src/main.rs b/zainod/src/main.rs index 24f2cac5..b8a31234 100644 --- a/zainod/src/main.rs +++ b/zainod/src/main.rs @@ -1,11 +1,11 @@ //! Zingo-Indexer daemon -use clap::Parser; +use clap::{CommandFactory, Parser}; use std::path::PathBuf; use zainodlib::{config::load_config, indexer::Indexer}; #[derive(Parser, Debug)] -#[command(name = "zindexer", about = "A server for Zingo-Indexer")] +#[command(name = "Zaino", about = "The Zcash Indexing Service", version)] struct Args { /// Path to the configuration file #[arg(short, long, value_name = "FILE")] @@ -14,8 +14,16 @@ struct Args { #[tokio::main] async fn main() { + let args = Args::parse(); + + if std::env::args().any(|arg| arg == "--version" || arg == "-V") { + let cmd = Args::command(); + println!("{}", cmd.get_version().unwrap()); + return; + } + Indexer::start(load_config( - &Args::parse() + &args .config .unwrap_or_else(|| PathBuf::from("./zainod/zindexer.toml")), ))