Fix: UI was build buggy, fix it.

This commit is contained in:
Matthias Beyer 2017-07-20 22:57:45 +02:00
parent ecb9bcc861
commit d381702e8c
3 changed files with 25 additions and 20 deletions

View file

@ -29,14 +29,16 @@ pub fn start(rt: &Runtime) -> i32 {
let (_, cmd) = rt.cli().subcommand();
let cmd = cmd.unwrap(); // checked in main()
let start = match cmd.value_of("start-time").map(::chrono::naive::NaiveDateTime::from_str) {
None => ::chrono::offset::Local::now().naive_local(),
Some(Ok(ndt)) => ndt,
Some(Err(e)) => {
trace_error(&e);
error!("Cannot continue, not having start time");
return 1
},
let start = match cmd.value_of("start-time") {
None | Some("now") => ::chrono::offset::Local::now().naive_local(),
Some(ndt) => match ::chrono::naive::NaiveDateTime::from_str(ndt) {
Ok(ndt) => ndt,
Err(e) => {
trace_error(&e);
error!("Cannot continue, not having start time");
return 1
},
}
};
cmd.values_of("tags")

View file

@ -37,16 +37,19 @@ pub fn stop(rt: &Runtime) -> i32 {
let (_, cmd) = rt.cli().subcommand();
let cmd = cmd.unwrap(); // checked in main()
let stop_time = match cmd.value_of("stop-time").map(::chrono::naive::NaiveDateTime::from_str) {
None => ::chrono::offset::Local::now().naive_local(),
Some(Ok(ndt)) => ndt,
Some(Err(e)) => {
trace_error(&e);
error!("Cannot continue, not having stop time");
return 1
},
let stop_time = match cmd.value_of("stop-time") {
None | Some("now") => ::chrono::offset::Local::now().naive_local(),
Some(ndt) => match ::chrono::naive::NaiveDateTime::from_str(ndt) {
Ok(ndt) => ndt,
Err(e) => {
trace_error(&e);
error!("Cannot continue, not having start time");
return 1
},
}
};
// TODO: We do not yet support stopping all tags by simply calling the "stop" subcommand!
let tags : Vec<TimeTrackingTag> = cmd.values_of("tags")

View file

@ -25,8 +25,8 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.version("0.1")
.arg(Arg::with_name("start-time")
.index(1)
.required(false)
.help("Start-time when to start the timetracking"))
.required(true)
.help("Start-time when to start the timetracking (use 'now' for current time)"))
.arg(Arg::with_name("tags")
.index(2)
.required(true)
@ -39,8 +39,8 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.version("0.1")
.arg(Arg::with_name("end-time")
.index(1)
.required(false)
.help("End-time when to stop the timetracking"))
.required(true)
.help("End-time when to stop the timetracking (use 'now' for current time)"))
.arg(Arg::with_name("tags")
.index(2)
.required(true)