Adds the version command to tari_base_node
Update parser.rs
@@ -80,11 +80,14 @@ use tari_wallet::{
};
use tokio::{runtime, time};
+const VERSION: &'static str = env!("CARGO_PKG_VERSION");
+
/// Enum representing commands used by the basenode
#[derive(Clone, PartialEq, Debug, Display, EnumIter, EnumString)]
#[strum(serialize_all = "kebab_case")]
pub enum BaseNodeCommand {
Help,
+ Version,
GetBalance,
ListUtxos,
ListTransactions,
@@ -236,6 +239,9 @@ impl Parser {
Help => {
self.print_help(args);
},
+ Version => {
+ self.print_version();
+ },
GetBalance => {
self.process_get_balance();
},
@@ -329,6 +335,9 @@ impl Parser {
let joined = self.commands.join(", ");
println!("{}", joined);
},
+ Version => {
+ println!("Gets the current application version");
+ },
GetBalance => {
println!("Gets your balance");
},
@@ -433,6 +442,11 @@ impl Parser {
});
}
+ /// Function process the version command
+ fn print_version(&mut self) {
+ println!("Version: {}", VERSION);
+ }
+
/// Function to process the list utxos command
fn process_list_unspent_outputs(&mut self) {
let mut handler1 = self.node_service.clone();
