Add more help information.

This commit is contained in:
Nicolás A. Ortega Froysa 2022-07-19 22:56:37 +02:00
parent b5781619db
commit 20172f5f27
2 changed files with 17 additions and 17 deletions

View File

@ -142,7 +142,7 @@ impl HabitMgr
self.export_habits(); self.export_habits();
} }
pub fn list(&mut self, _all:bool, _verbose:bool) pub fn list(&mut self, _all:bool)
{ {
self.import_habits(); self.import_habits();
if self.habits.is_empty() if self.habits.is_empty()

View File

@ -42,13 +42,15 @@ enum Command
#[structopt(alias = "a")] #[structopt(alias = "a")]
Add Add
{ {
#[structopt(help = "name of the new habit")] #[structopt(help = "Name of the new habit")]
name:String, name:String,
#[structopt(long, short, default_value = "mon,tue,wed,thu,fri,sat,sun")] #[structopt(long, short, help = "Days the new habit is active",
default_value = "mon,tue,wed,thu,fri,sat,sun")]
days:String, days:String,
#[structopt(long)] #[structopt(long, help = "Assign habit as a bad habit (negative points)")]
bad:bool, bad:bool,
#[structopt(short, long, default_value = "5")] #[structopt(short, long, help = "Weight/priority of the new habit",
default_value = "5")]
weight:u8, weight:u8,
}, },
Commit { }, Commit { },
@ -59,31 +61,29 @@ enum Command
}, },
#[structopt(alias = "i")] #[structopt(alias = "i")]
Info { Info {
#[structopt(help = "ID of the habit to show information for")]
id:usize, id:usize,
}, },
#[structopt(alias = "ls")] #[structopt(alias = "ls")]
List List
{ {
#[structopt(short, long, help = "list all active habits")] #[structopt(short, long, help = "List all active habits")]
all:bool, all:bool,
#[structopt(short, long, help = "show UUIDs")]
verbose:bool,
}, },
#[structopt(alias = "mod")] #[structopt(alias = "mod")]
Modify { Modify {
#[structopt(help = "ID of the habit to modify")] #[structopt(help = "ID of the habit to modify")]
id:usize, id:usize,
#[structopt(short, long)] #[structopt(short, long, help = "New name for the habit")]
name:Option<String>, name:Option<String>,
#[structopt(short, long)] #[structopt(short, long, help = "New weight of the habit")]
weight:Option<u8>, weight:Option<u8>,
#[structopt(long, short)] #[structopt(long, short, help = "New days the habit is active")]
days:Option<String>, days:Option<String>,
#[structopt(long)] #[structopt(long, help = "Toggle the 'bad' value of the habit")]
toggle_bad:bool, toggle_bad:bool,
}, },
#[structopt(alias = "stats")] Stats { },
Statistics { },
} }
fn main() fn main()
@ -112,7 +112,7 @@ fn main()
match opts.cmd match opts.cmd
{ {
None => hmgr.list(false, false), None => hmgr.list(false),
Some(c) => Some(c) =>
match c match c
{ {
@ -122,8 +122,8 @@ fn main()
hmgr.delete(id), hmgr.delete(id),
Command::Info { id } => Command::Info { id } =>
hmgr.habit_info(id), hmgr.habit_info(id),
Command::List { all, verbose } => Command::List { all } =>
hmgr.list(all, verbose), hmgr.list(all),
Command::Modify { id, name, weight, days, toggle_bad } => Command::Modify { id, name, weight, days, toggle_bad } =>
hmgr.modify(id, name, toggle_bad, weight, days), hmgr.modify(id, name, toggle_bad, weight, days),
_ => todo!(), _ => todo!(),