Skip to content

Commit 9c26aca

Browse files
committed
fmt
1 parent b0e8a1d commit 9c26aca

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

src/note.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
use crate::{
22
api, multiselect,
3-
prompts::{confirm::confirm, input::{single, multi}, select::select},
3+
prompts::{
4+
confirm::confirm,
5+
input::{multi, single},
6+
select::select,
7+
},
48
truncate_note,
59
utilities::{cursor_to_origin::cursor_to_origin, display::display},
610
};

src/prompts/input.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
use crate::{main, return_to_main};
22
use dialoguer::{theme::ColorfulTheme, Input};
33

4-
pub fn single(prompt: &str, initial_text: String, is_required: bool) -> Result<String, Box<dyn std::error::Error>> {
4+
pub fn single(
5+
prompt: &str,
6+
initial_text: String,
7+
is_required: bool,
8+
) -> Result<String, Box<dyn std::error::Error>> {
59
let mut result: String;
610

711
loop {
@@ -62,4 +66,4 @@ pub fn multi(prompt: &str, initial_text: String) -> Result<String, Box<dyn std::
6266
}
6367

6468
Ok(result)
65-
}
69+
}

src/utilities/truncate_note.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ pub fn truncate_note(
66
db_file: &PathBuf,
77
) -> Result<(), Box<dyn std::error::Error>> {
88
for note in &get_notes(db_file)? {
9-
let mut truncated_content: String = note.content.chars().take(10).collect::<String>().replace("\n", " ");
9+
let mut truncated_content: String = note
10+
.content
11+
.chars()
12+
.take(10)
13+
.collect::<String>()
14+
.replace("\n", " ");
1015
if truncated_content.chars().count() == 10 {
1116
truncated_content += "..."; // this is cursed and awesome at the same time
1217
}

0 commit comments

Comments
 (0)