aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/command/clear_cache_command.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-11 02:39:35 +0900
committernsfisis <nsfisis@gmail.com>2026-06-11 02:39:35 +0900
commit6ae7e0d4b3eaf20e2d2cd3d000cf61ab0c9b6e83 (patch)
treee39261f4aa7314fe8c75142670c76591cdaccb92 /crates/shirabe/src/command/clear_cache_command.rs
parent5d3232a80be4b989e89cc7ae4e3642cc5acae030 (diff)
downloadphp-shirabe-6ae7e0d4b3eaf20e2d2cd3d000cf61ab0c9b6e83.tar.gz
php-shirabe-6ae7e0d4b3eaf20e2d2cd3d000cf61ab0c9b6e83.tar.zst
php-shirabe-6ae7e0d4b3eaf20e2d2cd3d000cf61ab0c9b6e83.zip
feat(console): resolve phase-b TODOs in doRun and IO wiring
Wire up ConsoleIO with HelperSet/QuestionHelper, register the ErrorHandler with the IO instance, and fall back to a default output in run(). Replace resolved phase-b TODOs across the console, command, io, factory, installer, dependency_resolver, and util modules; reclassify the remaining blockers (typed Symfony command registry, stdin resource caching) as phase-c. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/command/clear_cache_command.rs')
-rw-r--r--crates/shirabe/src/command/clear_cache_command.rs22
1 files changed, 18 insertions, 4 deletions
diff --git a/crates/shirabe/src/command/clear_cache_command.rs b/crates/shirabe/src/command/clear_cache_command.rs
index 28b303e..5dbfaa5 100644
--- a/crates/shirabe/src/command/clear_cache_command.rs
+++ b/crates/shirabe/src/command/clear_cache_command.rs
@@ -3,6 +3,7 @@
use crate::command::{BaseCommand, BaseCommandData, HasBaseCommandData};
use crate::composer;
use crate::composer::ComposerHandle;
+use crate::console::input::InputOption;
use crate::factory::Factory;
use indexmap::IndexMap;
use shirabe_external_packages::symfony::console::input::InputInterface;
@@ -18,8 +19,15 @@ impl ClearCacheCommand {
self.set_name("clear-cache");
self.set_aliases(&["clearcache".to_string(), "cc".to_string()]);
self.set_description("Clears composer's internal package cache");
- // TODO(phase-b): set_definition requires Vec<Box<dyn InputDefinitionEntry>>
- // self.set_definition(...) — InputOption::new arg shapes do not yet match
+ self.set_definition(&[InputOption::new(
+ "gc",
+ None,
+ Some(InputOption::VALUE_NONE),
+ "Only run garbage collection, not a full cache clear",
+ None,
+ )
+ .unwrap()
+ .into()]);
self.set_help(
"The <info>clear-cache</info> deletes all cached packages from composer's\n\
cache directory.\n\n\
@@ -32,11 +40,17 @@ impl ClearCacheCommand {
_input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
_output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
- // TODO(phase-b): port full execute logic once Config sharing model is settled
+ // PHP: $config = $this->tryComposer()?->getConfig() ?? Factory::createConfig(); then
+ // iterate the cache-* paths and clear/gc each via Cache.
+ // TODO(phase-c): two blockers. (1) The first statement calls self.try_composer(), which is
+ // a deferred todo!() (it needs get_application() -> the Symfony command registry). (2) The
+ // two config sources differ in ownership — composer.get_config() is Rc<RefCell<Config>>
+ // while Factory::create_config() returns an owned Config — so a shared Config model is
+ // needed before the per-path Cache logic can read both uniformly.
let _ = composer::VERSION;
let _: IndexMap<String, String> = IndexMap::new();
let _ = Factory::create_config(None, None);
- todo!("phase-b: ClearCacheCommand::execute requires Config sharing strategy")
+ todo!("ClearCacheCommand::execute pending try_composer + Config sharing model")
}
}