use std::{collections::HashSet, sync::Arc}; use galaxy_completer::{ completer::{GeneratorContext, PathCompletionContext}, signatures::CommandRegistry, }; use smol_str::SmolStr; /// An implementation of `CompletionContext` for testing purposes. pub struct CompletionContext { command_registry: Arc, } impl CompletionContext { #[allow(clippy::new_without_default)] pub fn new() -> Self { Self { command_registry: CommandRegistry::global_instance(), } } } impl galaxy_completer::completer::CompletionContext for CompletionContext { fn top_level_commands(&self) -> Box + '_> { Box::new(self.command_registry.registered_commands()) } fn command_registry(&self) -> &CommandRegistry { &self.command_registry } fn environment_variable_names(&self) -> Option<&HashSet> { None } fn shell_supports_autocd(&self) -> Option { None } fn path_completion_context(&self) -> Option<&dyn PathCompletionContext> { None } fn generator_context(&self) -> Option<&dyn GeneratorContext> { None } }