Skip to content

Commit

Permalink
Rename to print_with
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkdp committed Dec 28, 2024
1 parent de4f6c2 commit 1c30a82
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion numbat-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ impl Cli {
interactive: bool,
) -> Result<()> {
let mut cmd_runner = CommandRunner::<Editor<NumbatHelper, DefaultHistory>>::new()
.enable_print_markup(|m| println!("{}", ansi_format(m, true)))
.print_with(|m| println!("{}", ansi_format(m, true)))
.enable_clear(|rl| match rl.clear_screen() {
Ok(_) => CommandControlFlow::Continue,
Err(_) => CommandControlFlow::Return,
Expand Down
8 changes: 3 additions & 5 deletions numbat/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl<Editor> CommandRunner<Editor> {
Self::default()
}

pub fn enable_print_markup(mut self, action: fn(&Markup)) -> Self {
pub fn print_with(mut self, action: fn(&Markup)) -> Self {
self.print_markup = Some(action);
self
}
Expand Down Expand Up @@ -557,7 +557,7 @@ mod test {

fn new_runner() -> CommandRunner<()> {
CommandRunner::new()
.enable_print_markup(|_| {})
.print_with(|_| {})
.enable_clear(|_| CommandControlFlow::Continue)
.enable_save(SessionHistory::new())
.enable_reset(Context::new_without_importer)
Expand Down Expand Up @@ -851,9 +851,7 @@ mod test {

let mut ctx = Context::new_without_importer();

let runner = CommandRunner::new()
.enable_print_markup(|_| {})
.enable_quit();
let runner = CommandRunner::new().print_with(|_| {}).enable_quit();

test_case(&runner, &mut ctx, "help", CommandControlFlow::Continue);
test_case(&runner, &mut ctx, "list", CommandControlFlow::Continue);
Expand Down

0 comments on commit 1c30a82

Please sign in to comment.