mirror of
https://github.com/nushell/reedline.git
synced 2024-09-11 15:55:50 +03:00
add history-clear to demo (#537)
This commit is contained in:
parent
d83cc56cb5
commit
572a391211
@ -149,6 +149,13 @@ fn main() -> Result<()> {
|
||||
line_editor.print_history()?;
|
||||
continue;
|
||||
}
|
||||
if buffer.trim() == "clear-history" {
|
||||
let hstry = Box::new(line_editor.history_mut());
|
||||
hstry
|
||||
.clear()
|
||||
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?;
|
||||
continue;
|
||||
}
|
||||
println!("Our buffer: {buffer}");
|
||||
#[cfg(any(feature = "sqlite", feature = "sqlite-dynlib"))]
|
||||
if !buffer.is_empty() {
|
||||
|
@ -411,6 +411,11 @@ impl Reedline {
|
||||
&*self.history
|
||||
}
|
||||
|
||||
/// Mutable view of the history
|
||||
pub fn history_mut(&mut self) -> &mut dyn History {
|
||||
&mut *self.history
|
||||
}
|
||||
|
||||
/// Update the underlying [`History`] to/from disk
|
||||
pub fn sync_history(&mut self) -> std::io::Result<()> {
|
||||
// TODO: check for interactions in the non-submitting events
|
||||
|
Loading…
Reference in New Issue
Block a user