forked from janek/mostr
1
0
Fork 0

feat(main): automatic readline history

This commit is contained in:
xeruf 2024-08-25 16:38:55 +03:00
parent 3cab294122
commit 1d7d3eea74
1 changed files with 2 additions and 0 deletions

View File

@ -18,6 +18,7 @@ use log::{debug, error, info, LevelFilter, trace, warn};
use nostr_sdk::prelude::*; use nostr_sdk::prelude::*;
use nostr_sdk::TagStandard::Hashtag; use nostr_sdk::TagStandard::Hashtag;
use regex::Regex; use regex::Regex;
use rustyline::config::Configurer;
use rustyline::DefaultEditor; use rustyline::DefaultEditor;
use rustyline::error::ReadlineError; use rustyline::error::ReadlineError;
use tokio::sync::mpsc; use tokio::sync::mpsc;
@ -143,6 +144,7 @@ pub(crate) enum MostrMessage {
#[tokio::main] #[tokio::main]
async fn main() -> Result<()> { async fn main() -> Result<()> {
let mut rl = DefaultEditor::new()?; let mut rl = DefaultEditor::new()?;
rl.set_auto_add_history(true);
let mut args = args().skip(1).peekable(); let mut args = args().skip(1).peekable();
let mut builder = if args.peek().is_some_and(|arg| arg == "--debug") { let mut builder = if args.peek().is_some_and(|arg| arg == "--debug") {