aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart/src/commands/repository.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-06 03:38:32 +0900
committernsfisis <nsfisis@gmail.com>2026-05-06 04:05:13 +0900
commitbf96f8292c0e9818c8b5fc8713ca7506e4338a49 (patch)
tree61ddecc119ee0ae344eabdb9c0f784cdb3461a44 /crates/mozart/src/commands/repository.rs
parentb97e34358be5df05a3db9f5f3ef1502eaa94b1c0 (diff)
downloadphp-mozart-bf96f8292c0e9818c8b5fc8713ca7506e4338a49.tar.gz
php-mozart-bf96f8292c0e9818c8b5fc8713ca7506e4338a49.tar.zst
php-mozart-bf96f8292c0e9818c8b5fc8713ca7506e4338a49.zip
refactor(console): add write macros and migrate commands to use them
Diffstat (limited to 'crates/mozart/src/commands/repository.rs')
-rw-r--r--crates/mozart/src/commands/repository.rs20
1 files changed, 6 insertions, 14 deletions
diff --git a/crates/mozart/src/commands/repository.rs b/crates/mozart/src/commands/repository.rs
index 5bb3db7..c2d2bd8 100644
--- a/crates/mozart/src/commands/repository.rs
+++ b/crates/mozart/src/commands/repository.rs
@@ -1,5 +1,6 @@
use anyhow::anyhow;
use clap::Args;
+use mozart_core::console_writeln;
use std::path::PathBuf;
use super::config_helpers::{
@@ -91,10 +92,7 @@ fn execute_list(
if let Some(obj) = entry.as_object() {
// Check for disabled repo entry like {"packagist.org": false}
if let Some((key, _)) = obj.iter().find(|(_, v)| v == &&serde_json::json!(false)) {
- console.write_stdout(
- &format!("[{key}] disabled"),
- mozart_core::console::Verbosity::Normal,
- );
+ console_writeln!(console, &format!("[{key}] disabled"),);
if key == "packagist.org" {
has_packagist_disable = true;
}
@@ -112,16 +110,13 @@ fn execute_list(
.unwrap_or("unknown");
let url = entry.get("url").and_then(|u| u.as_str()).unwrap_or("");
- console.write_stdout(
- &format!("[{name}] {repo_type} {url}"),
- mozart_core::console::Verbosity::Normal,
- );
+ console_writeln!(console, &format!("[{name}] {repo_type} {url}"),);
}
if !has_packagist_disable {
- console.write_stdout(
+ console_writeln!(
+ console,
"[packagist.org] composer https://repo.packagist.org",
- mozart_core::console::Verbosity::Normal,
);
}
@@ -273,10 +268,7 @@ fn execute_get_url(
let entry = &repos[idx];
match entry.get("url") {
Some(url_val) => {
- console.write_stdout(
- &render_value(url_val),
- mozart_core::console::Verbosity::Normal,
- );
+ console_writeln!(console, &render_value(url_val),);
Ok(())
}
None => Err(anyhow!("The \"{name}\" repository does not have a URL")),