Skip to content

Commit

Permalink
Make inko pkg sync less verbose
Browse files Browse the repository at this point in the history
This removes some redundant output from the sync command.

Changelog: changed
  • Loading branch information
yorickpeterse committed May 22, 2024
1 parent 0292cd9 commit 42c4b28
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions inko/src/command/pkg/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,11 @@ pub(crate) fn run(args: &[String]) -> Result<i32, Error> {
return Ok(0);
}

println!("Updating package cache");

let config = Config::default();
let packages = download_packages()?;
let versions = select(packages.iter().map(|p| &p.dependency));

remove_dependencies(&config.dependencies)?;
println!("Installing");
install_packages(packages, versions, &config.dependencies)?;
Ok(0)
}
Expand Down Expand Up @@ -91,15 +88,15 @@ fn download_dependency(
let (mut repo, fetch) = if dir.is_dir() {
(Repository::open(&dir)?, true)
} else {
println!(" Downloading {} {}", dependency.url, dependency.version);
println!("Downloading {} v{}", dependency.url, dependency.version);
(Repository::clone(&url, &dir)?, false)
};

let tag_name = dependency.version.tag_name();
let tag = if let Some(tag) = repo.tag(&tag_name) {
Some(tag)
} else if fetch {
println!(" Updating {}", dependency.url);
println!("Updating {}", dependency.url);
repo.fetch()?;
repo.tag(&tag_name)
} else {
Expand Down Expand Up @@ -156,8 +153,6 @@ changes.",

fn remove_dependencies(directory: &Path) -> Result<(), String> {
if directory.is_dir() {
println!("Removing existing dependencies in {}", directory.display());

remove_dir_all(directory).map_err(|err| {
format!("Failed to remove {}: {}", directory.display(), err)
})?;
Expand All @@ -177,8 +172,6 @@ fn install_packages(
.collect::<HashMap<_, _>>();

for (url, ver) in versions {
println!(" {} {}", url, ver);

let repo = repos.get(&url).unwrap();
let tag_name = ver.tag_name();
let tag = repo.tag(&tag_name).unwrap();
Expand Down

0 comments on commit 42c4b28

Please sign in to comment.