From eea4efe87e455742ec17881ee93d8095925e8516 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 28 May 2026 22:43:11 +0900 Subject: refactor(repository): introduce Rc> handles for repositories Co-Authored-By: Claude Opus 4.7 (1M context) --- crates/shirabe/src/command/search_command.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'crates/shirabe/src/command/search_command.rs') diff --git a/crates/shirabe/src/command/search_command.rs b/crates/shirabe/src/command/search_command.rs index 2033cfc..5d6a31b 100644 --- a/crates/shirabe/src/command/search_command.rs +++ b/crates/shirabe/src/command/search_command.rs @@ -10,6 +10,7 @@ use crate::plugin::CommandEvent; use crate::plugin::PluginEvents; use crate::repository::CompositeRepository; use crate::repository::PlatformRepository; +use crate::repository::RepositoryInterfaceHandle; use crate::repository::repository_interface::{self, RepositoryInterface}; use anyhow::Result; use indexmap::IndexMap; @@ -78,18 +79,22 @@ impl SearchCommand { self.create_composer_instance(input, io_box, None, false, None)? }; let composer_ref = crate::command::composer_full(&composer); - // TODO(phase-b): get_local_repository returns &dyn InstalledRepositoryInterface but we need Box - let local_repo: Box = - todo!("share local_repo as RepositoryInterface"); - let installed_repo = CompositeRepository::new(vec![local_repo, Box::new(platform_repo)]); - let mut all_repos: Vec> = vec![Box::new(installed_repo)]; - // TODO(phase-b): get_repositories returns &Vec>; needs ownership reshape + let local_repo = composer_ref + .get_repository_manager() + .borrow() + .get_local_repository(); + let installed_repo = CompositeRepository::new(vec![ + local_repo, + RepositoryInterfaceHandle::new(platform_repo), + ]); + let mut all_repos: Vec = + vec![RepositoryInterfaceHandle::new(installed_repo)]; for r in composer_ref .get_repository_manager() .borrow() .get_repositories() { - all_repos.push(r.clone_box()); + all_repos.push(r.clone()); } let repos = CompositeRepository::new(all_repos); -- cgit v1.3.1