Skip to content

Commit

Permalink
[golemsp] new version notification in status
Browse files Browse the repository at this point in the history
  • Loading branch information
tworec committed Jan 22, 2021
1 parent 9bbbc7b commit c829ff4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 14 deletions.
25 changes: 13 additions & 12 deletions golem_cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,37 +1,38 @@
[package]
name = "golemsp"
description = "User friedly CLI for running provider"
description = "User friedly CLI for running Golem Provider"
version = "0.1.0"
authors = ["Golem Factory <contact@golem.network>"]
edition = "2018"

[dependencies]
actix-rt="1.1"
ya-compile-time-utils = "0.1"
ya-core-model = { version = "0.2", features=["payment", "version"] }
ya-utils-path = "0.1.0"
ya-utils-process = { version = "0.1.0", features = ["lock"] }

actix-rt="1.1"
ansi_term="0.12.1"
anyhow = "1.0"
bigdecimal = { version = "0.1.0"}
byte-unit = "4.0"
chrono = { version = "0.4", features=["serde"] }
crossterm="0.18.0"
directories = "2.0.2"
dotenv = "0.15"
env_logger = "0.7"
futures = "0.3"
log = "0.4"
names = "0.10.0"
prettytable-rs = "0.8.0"
promptly = "0.3.0"
rustyline="6.3.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
strip-ansi-escapes = "0.1"
structopt = "0.3"
tokio = { version = "0.2", features = ["process", "rt-core", "signal", "time", "io-util", "io-std"] }
url = "2.1"
directories = "2.0.2"
promptly = "0.3.0"
names = "0.10.0"
crossterm="0.18.0"
rustyline="6.3.0"
prettytable-rs = "0.8.0"
ansi_term="0.12.1"
ya-core-model = { version = "0.2.1", path="../core/model", features=["payment"] }
ya-utils-path = "0.1.0"
ya-utils-process = { version = "0.1.0", features = ["lock"] }

[target.'cfg(target_family = "unix")'.dependencies]
libc="0.2.73"
Expand Down
11 changes: 9 additions & 2 deletions golem_cli/src/command/yagna.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use std::process::Stdio;

use tokio::process::{Child, Command};
use ya_core_model::payment::local::{InvoiceStats, InvoiceStatusNotes, StatusNotes, StatusResult};
use ya_core_model::version::VersionInfo;

pub struct PaymentType {
pub platform: &'static str,
Expand All @@ -17,11 +18,11 @@ pub struct PaymentType {

impl PaymentType {
pub const ZK: PaymentType = PaymentType {
platform: "ZK-NGNT",
platform: "zksync-rinkeby-tglm",
driver: "zksync",
};
pub const PLAIN: PaymentType = PaymentType {
platform: "NGNT",
platform: "erc20-rinkeby-tglm",
driver: "ngnt",
};
}
Expand Down Expand Up @@ -106,6 +107,7 @@ impl YagnaCommand {
.output()
.await?;
if output.status.success() {
log::trace!("{}", String::from_utf8_lossy(&output.stdout));
Ok(serde_json::from_slice(&output.stdout)?)
} else {
Err(anyhow::anyhow!(
Expand All @@ -121,6 +123,11 @@ impl YagnaCommand {
output.map_err(anyhow::Error::msg)
}

pub async fn version(mut self) -> anyhow::Result<VersionInfo> {
self.cmd.args(&["--json", "version", "show"]);
self.run().await
}

pub async fn payment_status(
mut self,
address: Option<&str>,
Expand Down
8 changes: 8 additions & 0 deletions golem_cli/src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,15 @@ pub async fn run() -> Result</*exit code*/ i32> {
Style::new().fg(Colour::Red).paint("is not running")
]);
}

table.add_row(row!["Version", ya_compile_time_utils::version_describe!()]);
if let Some(pending) = cmd.yagna()?.version().await?.pending {
let ver = format!("{} released!", pending.version);
table.add_row(row![
"New Version",
Style::new().fg(Colour::Fixed(220)).paint(ver)
]);
}

table.add_empty_row();
table.add_row(row!["Node Name", &config.node_name.unwrap_or_default()]);
Expand Down

0 comments on commit c829ff4

Please sign in to comment.