From ca1c2005ea21c51699a3589894d7e243381500a6 Mon Sep 17 00:00:00 2001 From: Volodymyr Patuta <6977238-fiplox@users.noreply.gitlab.com> Date: Sun, 29 Nov 2020 14:59:36 +0100 Subject: [PATCH] better print of search by word --- src/rnote/notes.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/rnote/notes.rs b/src/rnote/notes.rs index af93f28..cfa8f58 100644 --- a/src/rnote/notes.rs +++ b/src/rnote/notes.rs @@ -120,6 +120,13 @@ pub fn modify(header: &str) -> Result<()> { Ok(()) } +fn print_path(path: String) { + let off = path.find(".rnote/").unwrap_or(path.len()) + 7; + let mut path = path; + path.drain(..off); + println!("{}", path); +} + pub fn search_by_word(word: &str) -> Result<()> { extern crate fstream; let path = get_base_path()?; @@ -134,7 +141,7 @@ pub fn search_by_word(word: &str) -> Result<()> { if b { let path = file.path().to_str().unwrap_or(""); if !path.is_empty() { - println!("{}", path); + print_path(path.to_owned()); } } }