Skip to content

Commit

Permalink
Merge branch 'master' into remove-store-when-uninstalling
Browse files Browse the repository at this point in the history
  • Loading branch information
crodas authored Feb 21, 2024
2 parents 2b57506 + ce89cdb commit 5e4add4
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 13 deletions.
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ name = "fuelup"
path = "src/main.rs"

[dependencies]
ansi_term = "0.12.1"
ansiterm = "0.12.2"
anyhow = "1"
clap = { version = "4.2.4", features = ["cargo", "derive", "env"] }
Expand Down
10 changes: 9 additions & 1 deletion src/fmt.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
use crate::target_triple::TargetTriple;
use ansi_term::Colour;
use ansiterm::Style;
use tracing::info;

use crate::target_triple::TargetTriple;
pub fn println_error<X: Into<String>>(txt: X) {
tracing::warn!("{}: {}", Colour::Red.paint("error"), txt.into());
}

pub fn println_warn<X: Into<String>>(txt: X) {
tracing::warn!("{}: {}", Colour::Yellow.paint("warning"), txt.into());
}

pub fn bold(text: &str) -> String {
let style = Style::new().bold();
Expand Down
9 changes: 8 additions & 1 deletion src/ops/fuelup_update.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
channel::Channel,
config::Config,
fmt::{bold, colored_bold},
fmt::{bold, colored_bold, println_error},
path::warn_existing_fuel_executables,
toolchain::{DistToolchainDescription, Toolchain},
};
Expand All @@ -20,6 +20,13 @@ pub fn update() -> Result<()> {

warn_existing_fuel_executables()?;

if toolchains.is_empty() {
println_error(
"No toolchains are installed. Use `fuelup default <toolchain>` to install a toolchain.",
);
return Ok(());
}

for toolchain in toolchains {
let mut installed_bins = String::new();
let mut errored_bins = String::new();
Expand Down
14 changes: 3 additions & 11 deletions src/path.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
use crate::{constants::FUEL_TOOLCHAIN_TOML_FILE, fmt::println_warn};
use anyhow::{bail, Result};
use component::Components;
use dirs;
use std::env;
use std::{
fs,
path::{Path, PathBuf},
};
use tracing::warn;

use dirs;

use crate::constants::FUEL_TOOLCHAIN_TOML_FILE;

pub const FUELUP_DIR: &str = ".fuelup";
pub const FUELUP_HOME: &str = "FUELUP_HOME";
Expand Down Expand Up @@ -76,8 +73,6 @@ pub fn warn_existing_fuel_executables() -> Result<()> {
vec![]
}

let mut summary = String::new();

for c in components {
for e in c.executables {
if let Some(path) = search_directories()
Expand Down Expand Up @@ -119,15 +114,12 @@ pub fn warn_existing_fuel_executables() -> Result<()> {
}

if !message.is_empty() {
summary.push_str(&message);
summary.push('\n');
println_warn(message);
}
}
}
}

warn!("{}", summary);

Ok(())
}

Expand Down

0 comments on commit 5e4add4

Please sign in to comment.