Skip to content

Commit

Permalink
fix doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
cactusdualcore committed Apr 15, 2024
1 parent d483ec0 commit ff0ef3d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/completion/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ use std::{
/// "hello world reedline".into(),
/// "this is the reedline crate".into(),
/// ];
/// let completer = Box::new(DefaultCompleter::new_with_wordlen(commands.clone(), 2));
/// let completer = DefaultCompleter::new_with_wordlen(commands.clone(), 2);
///
/// let mut line_editor = Reedline::create().with_completer(completer);
/// let mut line_editor = Reedline::builder().with_completions(completer).build();
/// ```
#[derive(Debug, Clone)]
pub struct DefaultCompleter {
Expand Down
2 changes: 1 addition & 1 deletion src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1495,7 +1495,7 @@ impl Reedline {
}

#[cfg(feature = "external_printer")]
fn external_messages(external_printer: &ExternalPrinter<String>) -> Result<Vec<String>> {
fn external_messages(external_printer: &ExternalPrinter<String>) -> io::Result<Vec<String>> {
let mut messages = Vec::new();
loop {
let result = external_printer.receiver().try_recv();
Expand Down
21 changes: 10 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
//! "hello world reedline".into(),
//! "this is the reedline crate".into(),
//! ];
//! let completer = Box::new(DefaultCompleter::new_with_wordlen(commands.clone(), 2));
//! let completer = DefaultCompleter::new_with_wordlen(commands.clone(), 2);
//! // Use the interactive menu to select options from the completer
//! let completion_menu = Box::new(ColumnarMenu::default().with_name("completion_menu"));
//! // Set up the required keybindings
Expand All @@ -118,12 +118,13 @@
//! ]),
//! );
//!
//! let edit_mode = Box::new(Emacs::new(keybindings));
//! let edit_mode = Emacs::new(keybindings);
//!
//! let mut line_editor = Reedline::create()
//! .with_completer(completer)
//! .with_menu(ReedlineMenu::EngineCompleter(completion_menu))
//! .with_edit_mode(edit_mode);
//! let mut line_editor = Reedline::builder()
//! .with_completions(completer)
//! .add_menu(ReedlineMenu::EngineCompleter(completion_menu))
//! .with_edit_mode(edit_mode)
//! .build();
//! ```
//!
//! ## Integrate with [`Hinter`] for fish-style history autosuggestions
Expand All @@ -141,10 +142,10 @@
//! };
//!
//!
//! let mut line_editor = Reedline::create().with_hinter(Box::new(
//! let mut line_editor = Reedline::builder().with_hints(
//! DefaultHinter::default()
//! .with_style(Style::new().italic().fg(Color::LightGray)),
//! ));
//! );
//! ```
//!
//!
Expand All @@ -155,9 +156,7 @@
//!
//! use reedline::{DefaultValidator, Reedline};
//!
//! let validator = Box::new(DefaultValidator);
//!
//! let mut line_editor = Reedline::create().with_validator(validator);
//! let mut line_editor = Reedline::builder().with_validator(DefaultValidator).build();
//! ```
//!
//! ## Use custom [`EditMode`]
Expand Down

0 comments on commit ff0ef3d

Please sign in to comment.