Skip to main content

brush_core/shell/
completion.rs

1//! Command completion support for shell instances.
2
3use crate::{completion, error, extensions};
4
5impl<SE: extensions::ShellExtensions> crate::Shell<SE> {
6    /// Generates command completions for the shell.
7    ///
8    /// # Arguments
9    ///
10    /// * `input` - The input string to generate completions for.
11    /// * `position` - The position in the input string to generate completions at.
12    pub async fn complete(
13        &mut self,
14        input: &str,
15        position: usize,
16    ) -> Result<completion::Completions, error::Error> {
17        let completion_config = self.completion_config.clone();
18        completion_config
19            .get_completions(self, input, position)
20            .await
21    }
22}