Skip to content
This repository was archived by the owner on Sep 7, 2025. It is now read-only.

Commit 12443e4

Browse files
feat(ui/ux): clean up install command cli prints for bottles and casks
Signed-off-by: Alexander Knott <alexander.knott@r-kom.de>
1 parent eac3cdc commit 12443e4

File tree

4 files changed

+20
-32
lines changed

4 files changed

+20
-32
lines changed

spm-cli/src/cli/install/cask.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ fn join_to_err(e: JoinError) -> SpmError {
1616
}
1717

1818
pub async fn run_cask_install(token: &str, cache: Arc<Cache>, cfg: &Config) -> Result<()> {
19-
info!("Processing cask: {}", token.cyan());
2019
let cask: Cask = match api::get_cask(token).await {
2120
Ok(c) => c,
2221
Err(e) => {
@@ -54,7 +53,7 @@ pub async fn run_cask_install(token: &str, cache: Arc<Cache>, cfg: &Config) -> R
5453
}
5554
}
5655

57-
info!("Downloading artifact for {}", token);
56+
info!("Downloading {}", token.cyan());
5857
let dl_path: PathBuf = match build::cask::download_cask(&cask, cache.as_ref()).await {
5958
Ok(p) => p,
6059
Err(e) => {
@@ -63,7 +62,7 @@ pub async fn run_cask_install(token: &str, cache: Arc<Cache>, cfg: &Config) -> R
6362
}
6463
};
6564

66-
debug!("Installing cask {} from {}...", token, dl_path.display());
65+
info!("Processing {}", token.cyan());
6766
tokio::task::spawn_blocking({
6867
let cask_clone = cask.clone();
6968
let dl_clone = dl_path.clone();
@@ -73,6 +72,5 @@ pub async fn run_cask_install(token: &str, cache: Arc<Cache>, cfg: &Config) -> R
7372
.await
7473
.map_err(join_to_err)??;
7574

76-
debug!("Cask {} installation task completed successfully", token);
7775
Ok(())
7876
}

spm-cli/src/cli/install/formula/bottle.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,12 @@ pub async fn run_bottle_install(
2525
let name = formula.name();
2626
let final_opt_path = get_formula_opt_path(formula, &cfg);
2727

28-
info!("Processing bottle for: {}...", name.cyan());
29-
3028
// Check if already installed (defensive check)
3129
let keg_registry = spm_core::keg::KegRegistry::new(cfg.clone());
3230
if let Some(keg) = keg_registry.get_installed_keg(name)? {
3331
if keg.version == *formula.version() && keg.revision == formula.revision {
3432
info!(
35-
"Formula {} v{} is already installed.",
33+
"{} v{} is already installed.",
3634
name,
3735
formula.version_str_full()
3836
);
@@ -48,12 +46,12 @@ pub async fn run_bottle_install(
4846
}
4947

5048
// Download
51-
info!("Downloading bottle for {}...", name);
49+
info!("Downloading {}", name.cyan());
5250
let bottle_path =
5351
build::formula::bottle::download_bottle(formula, &cfg, client.as_ref()).await?;
5452

5553
// Install (blocking)
56-
info!("Pouring bottle for {}...", name);
54+
info!("Processing {}", name.cyan());
5755
let install_dir: PathBuf = tokio::task::spawn_blocking({
5856
let formula_clone = formula.clone();
5957
let cfg_clone = cfg.clone();
@@ -65,10 +63,7 @@ pub async fn run_bottle_install(
6563
.await
6664
.map_err(join_to_err)??;
6765

68-
// Link
69-
info!("Linking artifacts for {}...", name);
7066
build::formula::link::link_formula_artifacts(formula, &install_dir, &cfg)?;
7167

72-
info!("Poured and linked {}", name.green());
7368
Ok(final_opt_path)
7469
}

spm-cli/src/cli/install/formula/source.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub async fn run_source_install(info: FormulaInstallInfo, cfg: Config) -> Result
1515
let resolved_graph = info.resolved_graph;
1616
let final_opt_path = get_formula_opt_path(formula, &cfg);
1717

18-
info!("Processing source build for: {}...", name.cyan());
18+
info!("Processing source build for: {}", name.cyan());
1919

2020
// Check if already installed (defensive check)
2121
let keg_registry = spm_core::keg::KegRegistry::new(cfg.clone());
@@ -37,10 +37,10 @@ pub async fn run_source_install(info: FormulaInstallInfo, cfg: Config) -> Result
3737
}
3838
}
3939

40-
info!("Downloading source for {}...", name);
40+
info!("Downloading source for {}", name);
4141
let source_path = build::formula::source::download_source(formula, &cfg).await?;
4242

43-
info!("Compiling {}...", name);
43+
info!("Compiling {}", name);
4444
let build_dep_paths = resolved_graph.build_dependency_opt_paths.clone();
4545
let runtime_dep_paths = resolved_graph.runtime_dependency_opt_paths.clone();
4646
let all_dep_paths = [build_dep_paths, runtime_dep_paths].concat();
@@ -53,9 +53,8 @@ pub async fn run_source_install(info: FormulaInstallInfo, cfg: Config) -> Result
5353
)
5454
.await?; // Await the result directly
5555

56-
info!("Linking artifacts for {}...", name);
56+
info!("Linking artifacts for {}", name);
5757
build::formula::link::link_formula_artifacts(formula, &install_dir, &cfg)?;
5858

59-
info!("Built and linked {}", name.green());
6059
Ok(final_opt_path)
6160
}

spm-cli/src/cli/install/mod.rs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ impl Install {
125125
plan_input.formulae_names.iter().cloned().collect();
126126

127127
if !formula_list_to_resolve.is_empty() {
128-
info!(
129-
"Resolving dependencies for {} potential formula(e)...",
128+
debug!(
129+
"Resolving dependencies for {} potential formula(e)",
130130
formula_list_to_resolve.len()
131131
);
132132
let formulary = Formulary::new(cfg.clone());
@@ -188,7 +188,7 @@ impl Install {
188188
}
189189
}
190190
} else {
191-
info!("No formulae identified for resolution.");
191+
debug!("No formulae identified for resolution.");
192192
}
193193

194194
let mut tasks_to_run: HashMap<String, TaskType> = HashMap::new();
@@ -234,7 +234,7 @@ impl Install {
234234
debug!("Skipping adding cask task for '{}' due to previous error or unknown status.", name);
235235
}
236236
} else if tasks_to_run.contains_key(name) && !self.cask_only {
237-
warn!("Target '{}' identified as both Formula and Cask. Prioritizing Formula install.", name);
237+
info!("Target '{}' identified as both Formula and Cask. Prioritizing Formula install.", name);
238238
}
239239
}
240240

@@ -255,8 +255,7 @@ impl Install {
255255
}
256256

257257
info!(
258-
"Planning to install {} package(s): {:?}",
259-
task_list.len(),
258+
"Target with dependencies added: {:?}",
260259
task_list.iter().map(|(n, _)| n).collect::<Vec<_>>()
261260
);
262261

@@ -269,8 +268,6 @@ impl Install {
269268

270269
let mut task_iter = task_list.into_iter();
271270

272-
info!("{}", "Starting installation process...".blue().bold());
273-
274271
while pending_tasks > 0 {
275272
while let Ok(permit) = sem.clone().try_acquire_owned() {
276273
if let Some((task_name, task)) = task_iter.next() {
@@ -318,7 +315,7 @@ impl Install {
318315
debug!("Task completed for '{}': {:?}", name, result.is_ok());
319316
if let Err(SpmError::InstallError(ref msg)) = result {
320317
if msg.contains("already installed") {
321-
info!("☑️ Skipping already installed cask: {}", name.yellow());
318+
info!("Skipping installed cask: {}", name.yellow());
322319
task_results.insert(name, Ok(PathBuf::new()));
323320
} else {
324321
task_results.insert(name, result);
@@ -349,17 +346,16 @@ impl Install {
349346
}
350347
}
351348

352-
info!("Installation process finished.");
353349
let mut final_success = true;
354350

355351
for (name, result) in task_results {
356352
match result {
357353
Ok(path) => {
358354
if path.as_os_str().is_empty() {
359-
info!("Successfully installed/skipped cask: {}", name.green());
355+
info!("Successfully installed: {}", name.green());
360356
} else {
361357
info!(
362-
"Successfully installed formula: {} ({})",
358+
"Successfully installed: {} ({})",
363359
name.green(),
364360
path.display()
365361
);
@@ -404,16 +400,16 @@ impl Install {
404400
let targets_to_check: HashSet<String> = self.names.iter().cloned().collect();
405401

406402
if self.formula_only {
407-
info!("--formula-only specified: Treating all targets as formulae.");
403+
info!("--formula-only: Treating all targets as formulae");
408404
plan_input.formulae_names = targets_to_check;
409405
return Ok(plan_input);
410406
}
411407
if self.cask_only {
412-
info!("--cask-only specified: Treating all targets as casks.");
408+
info!("--cask-only: Treating all targets as casks.");
413409
plan_input.cask_names = targets_to_check;
414410
// Proceed to fetch cask deps below
415411
} else {
416-
info!("Classifying initial targets: {:?}", self.names);
412+
info!("Initial installation target(s): {:?}", self.names);
417413

418414
// Load formula and cask data concurrently from cache/API
419415
let formula_data_future =

0 commit comments

Comments
 (0)