Skip to content

Commit

Permalink
feat: Version subcomand #18
Browse files Browse the repository at this point in the history
  • Loading branch information
HakanVardarr authored and ursuscamp committed Nov 13, 2023
1 parent 8fd6f05 commit 429eae4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 0 additions & 1 deletion example.nomen.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,3 @@ password = "rpc password"
host = "localhost"
port = 8441
network = "bitcoin"

3 changes: 3 additions & 0 deletions nomen/src/config/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@ pub enum Subcommand {

/// Rescan the blockchain, given an optional starting blockheight. This operation is slow, it redownloads blocks.
Rescan { blockheight: Option<i64> },

/// Prints the current version of application
Version,
}
3 changes: 3 additions & 0 deletions nomen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ async fn main() -> anyhow::Result<()> {
config::Subcommand::Rescan { blockheight } => {
subcommands::rescan(&config, &pool, blockheight.unwrap_or_default()).await?;
}
config::Subcommand::Version => {
subcommands::version();
}
}

Ok(())
Expand Down
5 changes: 5 additions & 0 deletions nomen/src/subcommands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,8 @@ pub(crate) async fn rescan(

Ok(())
}

pub(crate) fn version() {
let version = env!("CARGO_PKG_VERSION");
println!("Current version is {version}");
}

0 comments on commit 429eae4

Please sign in to comment.