diff --git a/brush-shell/src/shell_factory.rs b/brush-shell/src/shell_factory.rs index 1a770ac8..58d70c04 100644 --- a/brush-shell/src/shell_factory.rs +++ b/brush-shell/src/shell_factory.rs @@ -50,6 +50,30 @@ impl AsMut for StubShell { } } +pub(crate) struct RustylineShellFactory; + +impl ShellFactory for RustylineShellFactory { + #[cfg(all(feature = "rustyline", any(windows, unix)))] + type ShellType = brush_interactive::RustylineShell; + #[cfg(any(not(feature = "rustyline"), not(any(windows, unix))))] + type ShellType = StubShell; + + #[allow(unused)] + async fn create( + &self, + options: &brush_interactive::Options, + ) -> Result { + #[cfg(all(feature = "rustyline", any(windows, unix)))] + { + brush_interactive::RustylineShell::new(options).await + } + #[cfg(any(not(feature = "rustyline"), not(any(windows, unix))))] + { + Err(brush_interactive::ShellError::InputBackendNotSupported) + } + } +} + pub(crate) struct ReedlineShellFactory; impl ShellFactory for ReedlineShellFactory {