diff --git a/src/commands/new.rs b/src/commands/new.rs index 14cb23c..3f44a00 100644 --- a/src/commands/new.rs +++ b/src/commands/new.rs @@ -24,7 +24,7 @@ fn prompt_input Result<(), String>>(prompt_text: &str, predicate: io::stdout().flush().unwrap(); let mut buffer = String::new(); io::stdin().read_line(&mut buffer).ok().expect("Failed to read line"); - let answer = buffer.trim_right_matches("\n").to_string(); + let answer = buffer.trim_right().to_string(); match predicate(&answer) { Ok(()) => { return answer; @@ -145,7 +145,7 @@ fn run_new(directory: PathBuf) -> tantivy::Result<()> { let schema = schema_builder.build(); let schema_json = format!("{}", serde_json::to_string_pretty(&schema).unwrap()); println!("\n{}\n", Style::new().fg(Green).paint(schema_json)); - Index::create(&directory, schema)?; + Index::create_in_dir(&directory, schema)?; Ok(()) }