1// This Source Code Form is subject to the terms of the Mozilla Public
2// License, v. 2.0. If a copy of the MPL was not distributed with this
3// file, You can obtain one at https://mozilla.org/MPL/2.0/.
45mod taskcluster;
67use console::Term;
89pub(crate) fn check_for_update() {
10if std::env::var("NIMBUS_CLI_SUPPRESS_UPDATE_CHECK").is_ok() {
11return;
12 }
13 taskcluster::check_taskcluster_for_update(|curr, next| {
14let term = Term::stderr();
15let txt_style = term.style().green();
16let cmd_style = term.style().yellow();
1718_ = term.write_line(&format!(
19"{}",
20 txt_style.apply_to(format!("An update is available: {} --> {}", curr, next))
21 ));
2223_ = if std::env::consts::OS != "windows" {
24 term.write_line(&format!("{}\n{}",
25 txt_style.apply_to("To update, run this command:"),
26 cmd_style.apply_to(" curl https://raw.githubusercontent.com/mozilla/application-services/main/install-nimbus-cli.sh | bash")
27 ))
28 } else {
29 term.write_line(&format!("{}",
30 txt_style.apply_to("To update follow the instructions at https://experimenter.info/nimbus-cli/install")
31 ))
32 };
33 });
34}