From b2827a73abe53f7ddee6d09184cf3f6115e8fd94 Mon Sep 17 00:00:00 2001 From: Mike Voronov Date: Wed, 26 May 2021 17:48:16 +0300 Subject: [PATCH] Avoid printing version to not TTY targets and after aqua command (#89) --- Cargo.lock | 37 +++++++++++++++++++------------------ tools/cli/Cargo.toml | 3 ++- tools/cli/src/main.rs | 10 +++++++++- 3 files changed, 30 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d724aae3..929d70f3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -218,9 +218,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.67" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" +checksum = "4a72c244c1ff497a746a7e1fb3d14bd08420ecda70c8f25c7112f2781652d787" [[package]] name = "cfg-if" @@ -640,9 +640,9 @@ dependencies = [ [[package]] name = "erased-serde" -version = "0.3.13" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0465971a8cc1fa2455c8465aaa377131e1f1cf4983280f474a13e68793aa770c" +checksum = "e5b36e6f2295f393f44894c6031f67df4d185b984cd54d08f768ce678007efcd" dependencies = [ "serde", ] @@ -1156,9 +1156,9 @@ checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" [[package]] name = "httpdate" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05842d0d43232b23ccb7060ecb0f0626922c21f30012e97b767b30afd4a5d4b9" +checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440" [[package]] name = "humantime" @@ -1195,9 +1195,9 @@ dependencies = [ [[package]] name = "hyper" -version = "0.14.7" +version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e5f105c494081baa3bf9e200b279e27ec1623895cd504c7dbef8d0b080fcf54" +checksum = "d3f71a7eea53a3f8257a7b4795373ff886397178cd634430ea94e12d7fe4fe34" dependencies = [ "bytes 1.0.1", "futures-channel", @@ -1207,7 +1207,7 @@ dependencies = [ "http", "http-body 0.4.2", "httparse", - "httpdate 1.0.0", + "httpdate 1.0.1", "itoa", "pin-project", "socket2 0.4.0", @@ -1237,7 +1237,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes 1.0.1", - "hyper 0.14.7", + "hyper 0.14.8", "native-tls", "tokio 1.6.0", "tokio-native-tls", @@ -1457,10 +1457,11 @@ checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" [[package]] name = "marine" -version = "0.6.4" +version = "0.6.5" dependencies = [ "Inflector", "anyhow", + "atty", "check-latest", "clap", "exitfailure", @@ -2464,7 +2465,7 @@ dependencies = [ "futures-util", "http", "http-body 0.4.2", - "hyper 0.14.7", + "hyper 0.14.8", "hyper-tls 0.5.0", "ipnet", "js-sys", @@ -2883,18 +2884,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.24" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" +checksum = "fa6f76457f59514c7eeb4e59d891395fab0b2fd1d40723ae737d64153392e9c6" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.24" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" +checksum = "8a36768c0fbf1bb15eca10defa29526bda730a2376c2ab4393ccfa16fb1a318d" dependencies = [ "proc-macro2", "quote", @@ -3219,9 +3220,9 @@ dependencies = [ [[package]] name = "vcpkg" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbdbff6266a24120518560b5dc983096efb98462e51d0d68169895b237be3e5d" +checksum = "025ce40a007e1907e58d5bc1a594def78e5573bb0b1160bc389634e8f12e4faa" [[package]] name = "vec_map" diff --git a/tools/cli/Cargo.toml b/tools/cli/Cargo.toml index 840acde5..b2f421ed 100644 --- a/tools/cli/Cargo.toml +++ b/tools/cli/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "marine" description = "Fluence Marine command line tool" -version = "0.6.4" +version = "0.6.5" authors = ["Fluence Labs"] repository = "https://github.com/fluencelabs/marine/tools/cli" license = "Apache-2.0" @@ -20,6 +20,7 @@ semver = "0.11.0" walrus = "0.18.0" Inflector = "0.11.4" +atty = "0.2.14" thiserror = "1.0.24" anyhow = "1.0.31" check-latest = "1.0.0" diff --git a/tools/cli/src/main.rs b/tools/cli/src/main.rs index 286efcf9..12f48c1d 100644 --- a/tools/cli/src/main.rs +++ b/tools/cli/src/main.rs @@ -48,7 +48,10 @@ pub fn main() -> Result<(), anyhow::Error> { let arg_matches = app.get_matches(); match arg_matches.subcommand() { - ("aqua", Some(args)) => aqua(args), + ("aqua", Some(args)) => { + // avoid printing version + return aqua(args); + } ("build", Some(args)) => build(args), ("set", Some(args)) => set(args), ("it", Some(args)) => it(args), @@ -57,6 +60,11 @@ pub fn main() -> Result<(), anyhow::Error> { (c, _) => Err(crate::errors::CLIError::NoSuchCommand(c.to_string()).into()), }?; + // avoid printing version update into not TTY targets + if !atty::is(atty::Stream::Stdout) { + return Ok(()); + } + if let Ok(Some(new_version)) = check_latest::check_max!() { use termion::color;