From 25fa6c6b079b100f1c3970662d06d63bd741c1f0 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 20 Jun 2026 03:08:31 +0900 Subject: refactor(package-discovery): extend BaseCommand as supertrait PHP's PackageDiscoveryTrait is mixed into classes extending BaseCommand and calls its methods directly. Model that with a supertrait bound so get_io, try_composer, require_composer, get_platform_requirement_filter and normalize_requirements come from BaseCommand instead of being redeclared and delegated per command. Propagate the Result returns at the call sites and drop the now-redundant per-command impls. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/shirabe/src/command/init_command.rs | 31 +----------------------------- 1 file changed, 1 insertion(+), 30 deletions(-) (limited to 'crates/shirabe/src/command/init_command.rs') diff --git a/crates/shirabe/src/command/init_command.rs b/crates/shirabe/src/command/init_command.rs index f345d76..d7beaf8 100644 --- a/crates/shirabe/src/command/init_command.rs +++ b/crates/shirabe/src/command/init_command.rs @@ -65,35 +65,6 @@ impl PackageDiscoveryTrait for InitCommand { { &mut self.repository_sets } - - fn get_io(&self) -> std::rc::Rc> { - todo!() - } - - fn try_composer(&self) -> Option { - todo!() - } - - fn require_composer( - &self, - disable_plugins: Option, - disable_scripts: Option, - ) -> PartialComposerHandle { - todo!() - } - - fn get_platform_requirement_filter( - &self, - input: std::rc::Rc>, - ) -> std::rc::Rc< - dyn crate::filter::platform_requirement_filter::PlatformRequirementFilterInterface, - > { - todo!() - } - - fn normalize_requirements(&self, requires: Vec) -> Vec> { - todo!() - } } impl Default for InitCommand { @@ -152,7 +123,7 @@ impl Command for InitCommand { input: Rc>, output: Rc>, ) -> anyhow::Result { - let io = PackageDiscoveryTrait::get_io(self); + let io = self.get_io(); let allowlist: Vec = vec![ "name".to_string(), -- cgit v1.3.1