patch category

This commit is contained in:
Volodymyr Patuta 2020-11-27 21:20:19 +01:00
parent 0d4dd55996
commit 91befad113
2 changed files with 7 additions and 5 deletions

View File

@ -13,10 +13,13 @@ pub fn make_app() -> App<'static, 'static> {
.arg( .arg(
Arg::with_name("category") Arg::with_name("category")
.help("Create note in category.") .help("Create note in category.")
.short("c") .index(2),
.long("category"),
) )
.arg(Arg::with_name("header").help("Give name to the file.")), .arg(
Arg::with_name("header")
.index(1)
.help("Give name to the file."),
),
) )
.subcommand( .subcommand(
SubCommand::with_name("remove") SubCommand::with_name("remove")

View File

@ -1,14 +1,13 @@
use crate::rnote::notes; use crate::rnote::notes;
use anyhow::Result; use anyhow::Result;
use clap::ArgMatches; use clap::ArgMatches;
use notes::modify;
use text_io::read; use text_io::read;
pub fn new(matches: &ArgMatches) -> Result<()> { pub fn new(matches: &ArgMatches) -> Result<()> {
let header = match matches.value_of("header") { let header = match matches.value_of("header") {
Some(s) => s.to_owned(), Some(s) => s.to_owned(),
None => { None => {
print!("Enter the name of your note: "); println!("Enter the name of your note: ");
read!() read!()
} }
}; };