diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-09 11:19:03 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-09 11:19:03 +0900 |
| commit | 6051927c8fa32cfffa102d2a170c5a6cf747a1b9 (patch) | |
| tree | 3fe6769c90cb03ca8f1b9b825e38ad459182361e /crates/shirabe-external-packages/src/symfony/console/completion/completion_suggestions.rs | |
| parent | e3e8806aec771e482899ed3470e920f7b291fa95 (diff) | |
| download | php-shirabe-6051927c8fa32cfffa102d2a170c5a6cf747a1b9.tar.gz php-shirabe-6051927c8fa32cfffa102d2a170c5a6cf747a1b9.tar.zst php-shirabe-6051927c8fa32cfffa102d2a170c5a6cf747a1b9.zip | |
refactor(symfony-console): extract symfony/console into the shirabe-symfony-console crate
Move `Symfony\Component\Console` out of shirabe-external-packages and
into its own crate, so the path is
`shirabe_symfony_console::application::Application` instead of
`shirabe_external_packages::symfony::console::application::Application`.
The `delegate_to_inner!` and `delegate_command_trait_impls_to_inner!`
macros move with it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-external-packages/src/symfony/console/completion/completion_suggestions.rs')
| -rw-r--r-- | crates/shirabe-external-packages/src/symfony/console/completion/completion_suggestions.rs | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/console/completion/completion_suggestions.rs b/crates/shirabe-external-packages/src/symfony/console/completion/completion_suggestions.rs deleted file mode 100644 index 02938552..00000000 --- a/crates/shirabe-external-packages/src/symfony/console/completion/completion_suggestions.rs +++ /dev/null @@ -1,76 +0,0 @@ -//! ref: composer/vendor/symfony/console/Completion/CompletionSuggestions.php - -use crate::symfony::console::completion::suggestion::Suggestion; -use crate::symfony::console::input::input_option::InputOption; - -/// PHP union type `string|Suggestion` used by `suggestValue`/`suggestValues`. -#[derive(Debug)] -pub enum StringOrSuggestion { - String(String), - Suggestion(Suggestion), -} - -/// Stores all completion suggestions for the current input. -#[derive(Debug)] -pub struct CompletionSuggestions { - value_suggestions: Vec<Suggestion>, - option_suggestions: Vec<std::rc::Rc<InputOption>>, -} - -impl Default for CompletionSuggestions { - fn default() -> Self { - Self::new() - } -} - -impl CompletionSuggestions { - pub fn new() -> Self { - Self { - value_suggestions: vec![], - option_suggestions: vec![], - } - } - - /// Add a suggested value for an input option or argument. - pub fn suggest_value(&mut self, value: StringOrSuggestion) -> &mut Self { - self.value_suggestions.push(match value { - StringOrSuggestion::Suggestion(value) => value, - StringOrSuggestion::String(value) => Suggestion::new(value), - }); - - self - } - - /// Add multiple suggested values at once for an input option or argument. - pub fn suggest_values(&mut self, values: Vec<StringOrSuggestion>) -> &mut Self { - for value in values { - self.suggest_value(value); - } - - self - } - - /// Add a suggestion for an input option name. - pub fn suggest_option(&mut self, option: std::rc::Rc<InputOption>) -> &mut Self { - self.option_suggestions.push(option); - - self - } - - /// Add multiple suggestions for input option names at once. - pub fn suggest_options(&mut self, options: Vec<std::rc::Rc<InputOption>>) -> &mut Self { - for option in options { - self.suggest_option(option); - } - - self - } - - pub fn get_option_suggestions(&self) -> &Vec<std::rc::Rc<InputOption>> { - &self.option_suggestions - } - - pub fn get_value_suggestions(&self) -> &Vec<Suggestion> { - &self.value_suggestions - } -} |
