From b717d6a832602d727cf936fa195b0fecaf411ed4 Mon Sep 17 00:00:00 2001 From: fiplox <56274824+fiplox@users.noreply.github.com> Date: Mon, 31 May 2021 18:00:34 +0200 Subject: [PATCH] category prompt when creating new note --- src/rnote/process.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/rnote/process.rs b/src/rnote/process.rs index 68397d3..d14642e 100644 --- a/src/rnote/process.rs +++ b/src/rnote/process.rs @@ -11,9 +11,15 @@ pub fn new(matches: &ArgMatches) -> Result<()> { .with_prompt("Name of your note") .interact_text()?, }; - let category = matches.value_of("category").unwrap_or(""); + let category = match matches.value_of("category") { + Some(s) => s.to_owned(), + None => Input::with_theme(&ColorfulTheme::default()) + .with_prompt("Category for your note") + .default("".to_string()) + .interact_text()?, + }; - notes::create(&header, category)?; + notes::create(&header, &category)?; Ok(()) }