diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-20 03:08:31 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-20 03:09:22 +0900 |
| commit | 25fa6c6b079b100f1c3970662d06d63bd741c1f0 (patch) | |
| tree | fb564230eb241d11e9616119ae5badc45e8caf30 /crates/shirabe/src/command/init_command.rs | |
| parent | 7d06a493514c20338278c8ffdf0ba2e0f0eed353 (diff) | |
| download | php-shirabe-25fa6c6b079b100f1c3970662d06d63bd741c1f0.tar.gz php-shirabe-25fa6c6b079b100f1c3970662d06d63bd741c1f0.tar.zst php-shirabe-25fa6c6b079b100f1c3970662d06d63bd741c1f0.zip | |
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) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/command/init_command.rs')
| -rw-r--r-- | crates/shirabe/src/command/init_command.rs | 31 |
1 files changed, 1 insertions, 30 deletions
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<std::cell::RefCell<dyn IOInterface>> { - todo!() - } - - fn try_composer(&self) -> Option<PartialComposerHandle> { - todo!() - } - - fn require_composer( - &self, - disable_plugins: Option<bool>, - disable_scripts: Option<bool>, - ) -> PartialComposerHandle { - todo!() - } - - fn get_platform_requirement_filter( - &self, - input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>, - ) -> std::rc::Rc< - dyn crate::filter::platform_requirement_filter::PlatformRequirementFilterInterface, - > { - todo!() - } - - fn normalize_requirements(&self, requires: Vec<String>) -> Vec<IndexMap<String, String>> { - todo!() - } } impl Default for InitCommand { @@ -152,7 +123,7 @@ impl Command for InitCommand { input: Rc<RefCell<dyn InputInterface>>, output: Rc<RefCell<dyn OutputInterface>>, ) -> anyhow::Result<i64> { - let io = PackageDiscoveryTrait::get_io(self); + let io = self.get_io(); let allowlist: Vec<String> = vec