Skip to content

Commit ee25871

Browse files
authored
Add --version support (#408)
1 parent e089e7d commit ee25871

File tree

4 files changed

+37
-1
lines changed

4 files changed

+37
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ cb-metrics = { path = "crates/metrics" }
3333
cb-pbs = { path = "crates/pbs" }
3434
cb-signer = { path = "crates/signer" }
3535
cipher = "0.4"
36-
clap = { version = "4.5.4", features = ["derive", "env"] }
36+
clap = { version = "4.5.48", features = ["derive", "env"] }
3737
color-eyre = "0.6.3"
3838
ctr = "0.9.2"
3939
derive_more = { version = "2.0.1", features = ["deref", "display", "from", "into"] }

bin/cli.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
use clap::Parser;
22

3+
/// Version string with a leading 'v'
4+
const VERSION: &str = concat!("v", env!("CARGO_PKG_VERSION"));
5+
6+
/// Subcommands and global arguments for the module
7+
#[derive(Parser, Debug)]
8+
#[command(name = "Commit-Boost CLI", version = VERSION, about, long_about = None)]
9+
struct Cli {}
10+
311
/// Main entry point of the Commit-Boost CLI
412
#[tokio::main]
513
async fn main() -> eyre::Result<()> {
14+
// Parse the CLI arguments (currently only used for version info, more can be
15+
// added later)
16+
let _cli = Cli::parse();
17+
618
color_eyre::install()?;
719
// set default backtrace unless provided
820

bin/pbs.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,20 @@ use clap::Parser;
77
use eyre::Result;
88
use tracing::{error, info};
99

10+
/// Version string with a leading 'v'
11+
const VERSION: &str = concat!("v", env!("CARGO_PKG_VERSION"));
12+
13+
/// Subcommands and global arguments for the module
14+
#[derive(Parser, Debug)]
15+
#[command(name = "Commit-Boost PBS Service", version = VERSION, about, long_about = None)]
16+
struct Cli {}
17+
1018
#[tokio::main]
1119
async fn main() -> Result<()> {
20+
// Parse the CLI arguments (currently only used for version info, more can be
21+
// added later)
22+
let _cli = Cli::parse();
23+
1224
color_eyre::install()?;
1325

1426
let _guard = initialize_tracing_log(PBS_MODULE_NAME, LogsSettings::from_env_config()?);

bin/signer.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,20 @@ use clap::Parser;
77
use eyre::Result;
88
use tracing::{error, info};
99

10+
/// Version string with a leading 'v'
11+
const VERSION: &str = concat!("v", env!("CARGO_PKG_VERSION"));
12+
13+
/// Subcommands and global arguments for the module
14+
#[derive(Parser, Debug)]
15+
#[command(name = "Commit-Boost Signer Service", version = VERSION, about, long_about = None)]
16+
struct Cli {}
17+
1018
#[tokio::main]
1119
async fn main() -> Result<()> {
20+
// Parse the CLI arguments (currently only used for version info, more can be
21+
// added later)
22+
let _cli = Cli::parse();
23+
1224
color_eyre::install()?;
1325

1426
let _guard = initialize_tracing_log(SIGNER_MODULE_NAME, LogsSettings::from_env_config()?);

0 commit comments

Comments
 (0)