Fix: UI was build buggy, fix it.
This commit is contained in:
parent
ecb9bcc861
commit
d381702e8c
3 changed files with 25 additions and 20 deletions
|
@ -29,14 +29,16 @@ pub fn start(rt: &Runtime) -> i32 {
|
||||||
let (_, cmd) = rt.cli().subcommand();
|
let (_, cmd) = rt.cli().subcommand();
|
||||||
let cmd = cmd.unwrap(); // checked in main()
|
let cmd = cmd.unwrap(); // checked in main()
|
||||||
|
|
||||||
let start = match cmd.value_of("start-time").map(::chrono::naive::NaiveDateTime::from_str) {
|
let start = match cmd.value_of("start-time") {
|
||||||
None => ::chrono::offset::Local::now().naive_local(),
|
None | Some("now") => ::chrono::offset::Local::now().naive_local(),
|
||||||
Some(Ok(ndt)) => ndt,
|
Some(ndt) => match ::chrono::naive::NaiveDateTime::from_str(ndt) {
|
||||||
Some(Err(e)) => {
|
Ok(ndt) => ndt,
|
||||||
trace_error(&e);
|
Err(e) => {
|
||||||
error!("Cannot continue, not having start time");
|
trace_error(&e);
|
||||||
return 1
|
error!("Cannot continue, not having start time");
|
||||||
},
|
return 1
|
||||||
|
},
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
cmd.values_of("tags")
|
cmd.values_of("tags")
|
||||||
|
|
|
@ -37,16 +37,19 @@ pub fn stop(rt: &Runtime) -> i32 {
|
||||||
let (_, cmd) = rt.cli().subcommand();
|
let (_, cmd) = rt.cli().subcommand();
|
||||||
let cmd = cmd.unwrap(); // checked in main()
|
let cmd = cmd.unwrap(); // checked in main()
|
||||||
|
|
||||||
let stop_time = match cmd.value_of("stop-time").map(::chrono::naive::NaiveDateTime::from_str) {
|
let stop_time = match cmd.value_of("stop-time") {
|
||||||
None => ::chrono::offset::Local::now().naive_local(),
|
None | Some("now") => ::chrono::offset::Local::now().naive_local(),
|
||||||
Some(Ok(ndt)) => ndt,
|
Some(ndt) => match ::chrono::naive::NaiveDateTime::from_str(ndt) {
|
||||||
Some(Err(e)) => {
|
Ok(ndt) => ndt,
|
||||||
trace_error(&e);
|
Err(e) => {
|
||||||
error!("Cannot continue, not having stop time");
|
trace_error(&e);
|
||||||
return 1
|
error!("Cannot continue, not having start time");
|
||||||
},
|
return 1
|
||||||
|
},
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// TODO: We do not yet support stopping all tags by simply calling the "stop" subcommand!
|
// TODO: We do not yet support stopping all tags by simply calling the "stop" subcommand!
|
||||||
|
|
||||||
let tags : Vec<TimeTrackingTag> = cmd.values_of("tags")
|
let tags : Vec<TimeTrackingTag> = cmd.values_of("tags")
|
||||||
|
|
|
@ -25,8 +25,8 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
|
||||||
.version("0.1")
|
.version("0.1")
|
||||||
.arg(Arg::with_name("start-time")
|
.arg(Arg::with_name("start-time")
|
||||||
.index(1)
|
.index(1)
|
||||||
.required(false)
|
.required(true)
|
||||||
.help("Start-time when to start the timetracking"))
|
.help("Start-time when to start the timetracking (use 'now' for current time)"))
|
||||||
.arg(Arg::with_name("tags")
|
.arg(Arg::with_name("tags")
|
||||||
.index(2)
|
.index(2)
|
||||||
.required(true)
|
.required(true)
|
||||||
|
@ -39,8 +39,8 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
|
||||||
.version("0.1")
|
.version("0.1")
|
||||||
.arg(Arg::with_name("end-time")
|
.arg(Arg::with_name("end-time")
|
||||||
.index(1)
|
.index(1)
|
||||||
.required(false)
|
.required(true)
|
||||||
.help("End-time when to stop the timetracking"))
|
.help("End-time when to stop the timetracking (use 'now' for current time)"))
|
||||||
.arg(Arg::with_name("tags")
|
.arg(Arg::with_name("tags")
|
||||||
.index(2)
|
.index(2)
|
||||||
.required(true)
|
.required(true)
|
||||||
|
|
Loading…
Reference in a new issue