diff --git a/src/rnote/app.rs b/src/rnote/app.rs index f818924..8a52214 100644 --- a/src/rnote/app.rs +++ b/src/rnote/app.rs @@ -54,6 +54,7 @@ pub fn make_app() -> App<'static, 'static> { .alias("l") .alias("ls") .about("List all notes or notes from a category.") + .arg(Arg::with_name("name").help("Name of the category.")) .arg( Arg::with_name("category") .help("List all notes from a category.") diff --git a/src/rnote/process.rs b/src/rnote/process.rs index 0b249e4..cb49449 100644 --- a/src/rnote/process.rs +++ b/src/rnote/process.rs @@ -69,10 +69,13 @@ pub fn edit(matches: &ArgMatches) -> Result<()> { pub fn list(matches: &ArgMatches) -> Result<()> { match matches.is_present("category") { true => { - let s: String = Input::with_theme(&ColorfulTheme::default()) - .with_prompt("Category:") - .interact_text()?; - notes::list_category(&s)?; + let name: String = match matches.value_of("name") { + Some(s) => s.to_string(), + None => Input::with_theme(&ColorfulTheme::default()) + .with_prompt("Category:") + .interact_text()?, + }; + notes::list_category(&name)?; } false => notes::list_all_notes()?, }