From 3b30f116cc647b6e27fa6a99d881faf64646fe2f Mon Sep 17 00:00:00 2001 From: Volodymyr Patuta <6977238-fiplox@users.noreply.gitlab.com> Date: Mon, 18 Jan 2021 15:14:12 +0100 Subject: [PATCH] check if there is notes before show --- src/rnote/notes.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/rnote/notes.rs b/src/rnote/notes.rs index 5fc4743..18bfe14 100644 --- a/src/rnote/notes.rs +++ b/src/rnote/notes.rs @@ -278,6 +278,9 @@ pub fn show_all() -> Result<()> { files.push(fs::read_to_string(file.path())?); } } + if files.is_empty() { + return Err(anyhow!("No notes found.")); + } let skin = show::make_skin(); let md = &files.join("---\n"); show::run_app(skin, md)?; @@ -313,6 +316,9 @@ pub fn show_category(category: &str) -> Result<()> { files.push(fs::read_to_string(file.path())?); } } + if files.is_empty() { + return Err(anyhow!("No notes found.")); + } let skin = show::make_skin(); let md = &files.join("---\n"); show::run_app(skin, md)?;