diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-28 22:43:11 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-28 22:43:43 +0900 |
| commit | eea4efe87e455742ec17881ee93d8095925e8516 (patch) | |
| tree | 6d242f4fdd0bf32f0494a6fbbd62bce9ed6e1dc7 /crates/shirabe/src/command/search_command.rs | |
| parent | cc5d73c05a0abca2eebcc8a6afa0b1543ee49850 (diff) | |
| download | php-shirabe-eea4efe87e455742ec17881ee93d8095925e8516.tar.gz php-shirabe-eea4efe87e455742ec17881ee93d8095925e8516.tar.zst php-shirabe-eea4efe87e455742ec17881ee93d8095925e8516.zip | |
refactor(repository): introduce Rc<RefCell<_>> handles for repositories
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/command/search_command.rs')
| -rw-r--r-- | crates/shirabe/src/command/search_command.rs | 19 |
1 files changed, 12 insertions, 7 deletions
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<dyn RepositoryInterface> - let local_repo: Box<dyn RepositoryInterface> = - todo!("share local_repo as RepositoryInterface"); - let installed_repo = CompositeRepository::new(vec![local_repo, Box::new(platform_repo)]); - let mut all_repos: Vec<Box<dyn RepositoryInterface>> = vec![Box::new(installed_repo)]; - // TODO(phase-b): get_repositories returns &Vec<Box<...>>; 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<RepositoryInterfaceHandle> = + 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); |
