From 2592062434eeb5fe814dbca953d5fd23458bc135 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 2 Aug 2026 11:04:17 +0900 Subject: feat(symfony-console): implement the shell completion command plumbing The _complete and completion commands were registered but always panicked: get_class_of_command / instantiate_completion_output / tail_debug_log were todo!() and the completion.bash resource was not shipped. - make Command::complete return anyhow::Result so completion errors propagate to CompleteCommand's catch-all (exit code 2) like PHP - add Command::get_class as the port hook for PHP's get_class() debug log; every command supplies its PHP FQCN via the delegation macro - embed Resources/completion.bash at compile time (single-binary port); get_supported_shells becomes a static list - implement tail_debug_log by moving the shared output handle into the 'static process callback - add OutputInterface::as_console_output so unsupported-shell errors go to stderr as in PHP - fix CompletionInput::bind to keep the argument name PHP assigns in the foreach head even when the loop breaks on the first unset argument; application-level completion always hit this and returned no suggestions Co-Authored-By: Claude Fable 5 --- .../src/symfony/console/completion/completion_input.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'crates/shirabe-external-packages/src/symfony/console/completion') diff --git a/crates/shirabe-external-packages/src/symfony/console/completion/completion_input.rs b/crates/shirabe-external-packages/src/symfony/console/completion/completion_input.rs index a16575de..8226b469 100644 --- a/crates/shirabe-external-packages/src/symfony/console/completion/completion_input.rs +++ b/crates/shirabe-external-packages/src/symfony/console/completion/completion_input.rs @@ -124,6 +124,9 @@ impl CompletionInput { .cloned() .collect(); for current_argument_name in argument_names { + // PHP's foreach assigns the key variable before the body runs, so on break + // $argumentName still names the first argument that has no bound value. + argument_name = Some(current_argument_name.clone()); if !self .inner .inner @@ -132,7 +135,6 @@ impl CompletionInput { { break; } - argument_name = Some(current_argument_name.clone()); let argument_value = self.inner.inner.arguments[¤t_argument_name].clone(); self.completion_name = Some(current_argument_name.clone()); -- cgit v1.3.1