Skip to content
This repository has been archived by the owner on Nov 18, 2024. It is now read-only.

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatFrogDev committed Apr 1, 2024
1 parent b0e8a1d commit 9c26aca
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/note.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
use crate::{
api, multiselect,
prompts::{confirm::confirm, input::{single, multi}, select::select},
prompts::{
confirm::confirm,
input::{multi, single},
select::select,
},
truncate_note,
utilities::{cursor_to_origin::cursor_to_origin, display::display},
};
Expand Down
8 changes: 6 additions & 2 deletions src/prompts/input.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
use crate::{main, return_to_main};
use dialoguer::{theme::ColorfulTheme, Input};

pub fn single(prompt: &str, initial_text: String, is_required: bool) -> Result<String, Box<dyn std::error::Error>> {
pub fn single(
prompt: &str,
initial_text: String,
is_required: bool,
) -> Result<String, Box<dyn std::error::Error>> {
let mut result: String;

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

Ok(result)
}
}
7 changes: 6 additions & 1 deletion src/utilities/truncate_note.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ pub fn truncate_note(
db_file: &PathBuf,
) -> Result<(), Box<dyn std::error::Error>> {
for note in &get_notes(db_file)? {
let mut truncated_content: String = note.content.chars().take(10).collect::<String>().replace("\n", " ");
let mut truncated_content: String = note
.content
.chars()
.take(10)
.collect::<String>()
.replace("\n", " ");
if truncated_content.chars().count() == 10 {
truncated_content += "..."; // this is cursed and awesome at the same time
}
Expand Down

0 comments on commit 9c26aca

Please sign in to comment.