aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart/src/commands/browse.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-02-22 11:07:42 +0900
committernsfisis <nsfisis@gmail.com>2026-02-22 11:15:29 +0900
commit9f0d210021c54f63c9984446862b6ec68834bc63 (patch)
treed1522b8047c60bc7ee7a9d832178dd24e1b07636 /crates/mozart/src/commands/browse.rs
parent2c243a3cb814939bbe40fda1608781825ab0d77d (diff)
downloadphp-mozart-9f0d210021c54f63c9984446862b6ec68834bc63.tar.gz
php-mozart-9f0d210021c54f63c9984446862b6ec68834bc63.tar.zst
php-mozart-9f0d210021c54f63c9984446862b6ec68834bc63.zip
refactor(async): migrate from blocking HTTP to async/await with tokio
Replace reqwest::blocking with async reqwest across the entire codebase. All command execute functions, registry API calls (packagist, downloader, resolver, lockfile), and the main entry point now use async/await with the tokio runtime. The pubgrub resolver runs on spawn_blocking since its DependencyProvider trait is synchronous, using Handle::block_on for async I/O within that context. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart/src/commands/browse.rs')
-rw-r--r--crates/mozart/src/commands/browse.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/mozart/src/commands/browse.rs b/crates/mozart/src/commands/browse.rs
index d662ec0..51ca340 100644
--- a/crates/mozart/src/commands/browse.rs
+++ b/crates/mozart/src/commands/browse.rs
@@ -18,7 +18,7 @@ pub struct BrowseArgs {
// ─── Main entry point ────────────────────────────────────────────────────────
-pub fn execute(
+pub async fn execute(
args: &BrowseArgs,
cli: &super::Cli,
console: &mozart_core::console::Console,
@@ -45,7 +45,7 @@ pub fn execute(
let mut exit_code = 0i32;
for package_name in &packages {
- match resolve_url(package_name, &working_dir, args.homepage)? {
+ match resolve_url(package_name, &working_dir, args.homepage).await? {
Some(url) => {
if args.show {
println!("{}", url);
@@ -76,7 +76,7 @@ pub fn execute(
// ─── URL resolution ───────────────────────────────────────────────────────────
-fn resolve_url(
+async fn resolve_url(
package_name: &str,
working_dir: &Path,
prefer_homepage: bool,
@@ -109,7 +109,7 @@ fn resolve_url(
}
// 3. Fall back to Packagist API
- match mozart_registry::packagist::fetch_package_versions(package_name, None) {
+ match mozart_registry::packagist::fetch_package_versions(package_name, None).await {
Ok(versions) => {
// Find the latest stable version (first non-dev, or fallback to first)
let best = versions